Announcement

Collapse
No announcement yet.

Casting GFxObject to GFxClikWidget fails

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Casting GFxObject to GFxClikWidget fails

    Hi, excuse me if this is a very basic error or mistake, but I couldn't find this description in the forum.

    My swf contains an option stepper widget I am trying to initialize in uscript

    Code:
    var GFxClikWidget myStepper;
    
    event bool WidgetInitialized(name WidgetName, name WidgetPath, GFxObject Widget)
    {
    	switch(WidgetName)
    	{
    		case 'myStepper':
    			`Log(">>>>>>>>>>>>>>>" @ Widget);
    			myStepper= GFxClikWidget(Widget);
    			ScreenResOption.AddEventListener('CLIK_click', OnMyStepperEvent);
    			break;
    		default:
    			break;
    	}
    	return true;
    }
    The widget object seems valid, I changed myStepper to GFxObject to test the assignment without errors. But trying to cast to GFxClikWidget fails, it always return none.

    Any idea why this can be happening? Perhaps a missing flag from the fla files?

    I set up from as3 a data provider, it also looks a correct behavior when importing the swf in UDK.
    On the GFx media player I get no warnings or errors.

    #2
    I found out that not only the options stepper fails the casting, but any other button on my scene. I guess this has to do with some general setup S:

    Comment


      #3
      At least I managed to find a workaround, but it seems an overhead to do this, basically I am catching this object during the start, it is very nested in my scene, I wonder if this is correct:

      Code:
      var GFxObject temp1, temp2, temp3;
      
      function bool start( optional bool StartPause = false )
      {
      	local GFxObject root;
      
      	
      	super.Start();
      	Advance(0);
      
      	root = GetVariableObject("_root");
          temp1= root.GetObject("subobj1");    
      	temp2 = temp1.GetObject("subobj22");    
      	temp3 = temp2.GetObject("subobj3");    
      	myStepper= GFxClikWidget(temp3.GetObject("myStepper", class'GFxClikWidget'));
      	myStepper.AddEventListener('CLIK_click', OnMyStepperEvent);
      	return TRUE;
      }
      That gives me a correct myStepper reference, why is this only working this way?
      I also tried invoking the nesting objects with root.GetObject("subobj1.subobj2...") it doesn't work.

      I am not entirely sure of this method, seems the object reference is correct but now I am creating a data provider to this GFxClikWidget and it doesn't get populated at all during run-time (even invalidating the data provider which is actually empty from as3).

      Any recommendations ?

      Comment


        #4
        Finally as fro the none reference I originally posted, it is due to the missing

        Code:
        WidgetBindings.Add((WidgetName="myStepper",WidgetClass=class'GFxCLIKWidget'))
        Without this binding the object in widgetinitialized won't be considered as a class'GFxCLIKWidget, then the cast will fail.
        Thank you guys.

        Comment

        Working...
        X