Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

WidgetInitialized in Scaleform 4 (AS3)

Collapse
This is a sticky topic.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • WidgetInitialized in Scaleform 4 (AS3)

    UPDATE: As of January 2012 UDK, WidgetInitialized & Event Listeners are back!

    WidgetInitialzied() is not currently working in the Nov 2011 UDK integration of Scaleform 4. It should be in the next release of UDK however, as the fix has been completed but not included in the current release.

    Until then, you can use potential workarounds such as ExternalInterface.call() or FSCommands to notify Unreal that a CLIK widget is on the stage. For example:

    In ActionScript 3:

    Code:
    //parameter 1 = button instance name
    //parameter 2 = button path
    //parameter 3 = button instance name (without quotes)
    
    ExternalInterface.call("WidgetInit", "myAS3Button", "this.myAS3Button", myAS3Button);

    Then in UnrealScript:

    Code:
    var GFxObject MyAS3Button;
    
    function WidgetInit(string WidgetName, string WidgetPath, GFxObject Widget)
    {    
        switch(WidgetName)
        {                 
            case ("myAS3Button"):
    	    MyAS3Button = Widget;
                SetWidgetPathBinding(MyAS3Button, name(WidgetPath));
                break;
            default:
                break;
        }
    }
    
    defaultproperties
    {	
    	WidgetBindings(0)={(WidgetName="myAS3Button",WidgetClass=class'GFxClikWidget')}
    }
    Sorry about that folks.

  • #2
    any chance of a patch?

    Comment


    • #3
      Hi, I have an issue here.

      Code:
      function WidgetInit(string WidgetName, string WidgetPath, GFxObject Widget)
      {    
      	switch(WidgetName)
          {                 
              case ("program"):
      		`Log("!!!!!!!! Widget = "$Widget);
      		`Log("!!!!!!!! GFxMyClass(Widget) = "$GFxMyClass(Widget));
          }
      }
      
      defaultproperties
      {
      	WidgetBindings.Add((WidgetName="program",WidgetClass=class'GFxMyClass'))
      
      	...
      }
      Where the widget is a MovieClip and GFxMyClass a GFxObject subclass. Widget returns a GFxObject, but GFxMyClass(Widget) returns none!

      Comment


      • #4
        I get WidgetInitialized called.
        But then when I add an event listener for buttonPress on my button, the event doesnt happen when I click the button :/

        Comment


        • #5
          Please can we get an update on this issue? AddEventListener is not working on AS3 GFxWidgets in the UDK December 2011 beta.

          Comment


          • #6
            It doesn't work, but you can go the other route for now, Hook in the event listener on the actionscript side and when it gets executed use the externalinterface.call route to get back to unreal script.

            Comment


            • #7
              Didn't the event names change in the December UDK? I believe I read something like that in another topic...
              I can't check it myself atm but all the event names (types) should be found here: [PATHTOUDKFOLDER]/Development/Flash/CLIK/gfx/events/EventTypes.as

              Comment


              • #8
                That file does not exist any longer. You will find that the ActionScript version is now added into the pathing.

                You may be able to play with the event labels, it has been renamed to buttonPress in AS3.0 land. 2.0 is still standard.

                scaleform.clik.events.ButtonEvent
                Code:
                        public static const PRESS:String = "buttonPress";
                        public static const CLICK:String = "buttonClick";
                        public static const DRAG_OVER:String = "dragOver";
                        public static const DRAG_OUT:String = "dragOut";
                        public static const RELEASE_OUTSIDE:String = "releaseOutside";

                Comment


                • #9
                  As of January 2012 UDK, WidgetInitialized & Event Listeners are back!

                  Comment


                  • #10
                    Originally posted by Matt Doyle View Post
                    UPDATE: As of January 2012 UDK, WidgetInitialized & Event Listeners are back!
                    Just pointing out to folks that the CLIK_Components_AS3.fla has been updated too and the components there now have the enableInitCallback in them (like in the example pictures).

                    We were using the December version and wondered where the enableInitCallback tickbox inside the components were... But with the latest build we could happily extend the components there and (re)created out component library All callbacks work now in AS3.

                    Comment


                    • #11
                      Hi guys, thanks for this update it clears up my current brick wall but I've only been able to make a crack in it.

                      I'm pretty sure my issue deals with the fact that I'm using the Flash Develop/Vectorian Giotto mix and AS2.
                      -I'm not sure if AS3 works with Vectorian Giotto (reason for my AS2 use, I started working on this yesterday so I'm still learning XD)

                      Anyways I got the ExternalInterface call to work within my AS2 code for my SWF but when I logged the Widgetname back in UnrealScript it's getting none as it's input, I'm not sure how that is happening since I'm passing the buttonName in the ExternalCall. So here are small clips of the mentioned code XD:

                      FlashDevelop AS2 externalcall:
                      ExternalInterface.call("WidgetInit", "TestButton", "this.TestButton", _root.TestButton);

                      UnrealScript default properties:
                      WidgetBindings.Add((WidgetName = "TestButton", WidgetClass = class'GFxCLIKWidget'))

                      UnrealScript WidgetInit:
                      // Callback automatically called for each object in the movie with enableInitCallback enabled
                      function WidgetInit(string WidgetName, string WidgetPath, GFxObject Widget)
                      {
                      `log("WidgetName: ");
                      `log(Widgetname);
                      //Determine which widget is being initialized and handleit accordingly

                      switch(Widgetname)
                      {
                      case ("TestButton"):
                      `log("BBQ");
                      `Log("!!!!!!!! Widget = "$Widget);
                      `Log("!!!!!!!! GFxCLIKWidget(Widget) = "$GFxCLIKWidget(Widget));
                      //save reference to the button
                      // the Widget is a cast to a GFxCLICKWidget to allow for event listeners - see WidgetBindings and ****!!!
                      TestButton = GFxCLIKWidget(Widget);
                      // Add a delegate for when this button is clicked
                      TestButton.AddEventListener('CLIK_press', CloseMovie);
                      break;
                      default:
                      break;
                      }

                      }



                      Update:
                      So the script log is returning:

                      !!!!!!!! Widget = GFxObject_0
                      !!!!!!!! GFxCLIKWidget(Widget) = None


                      I'll keep trying but I'm not sure if it's something I'm doing or just the tools im using

                      Comment


                      • #12
                        I can't support Vectorian unfortunately, and I don't believe you can use CLIK with Vectorian.

                        Comment


                        • #13
                          Thanks Matt

                          Comment

                          Working...
                          X