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

What does Invoke do?

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

  • What does Invoke do?

    I mean I get it or I don't. Not sure.

    I can update GFxObjects directly and have them update without Invoke. Then I see it's used at specific times. Is it when we want to change a bunch of settings at once?

  • #2
    /**
    * Calls an ActionScript function on the movie, with the values from the args array as its parameters. This is slower than creating a wrapper function to call the ActionScript method
    * using one of the ActionScript*() methods below, but does not require a subclass to implement. Use this for one-off functions, or functions with variable length arguments
    */
    native function ASValue Invoke(string method, array<ASValue> args);

    Comment


    • #3
      Invoke should be avoided unless it is really necessary. There are two methods to talk to ActionScript/Flash you should try first:

      1. DirectAccessAPI

      If you wish to simply change a display object (UI element), use this. For instance, if you want to change a textfield's text:

      Code:
      MyTextfield.SetString("text", "blah blah blah");
      2. Wrapped UnrealScript Functions

      You can call an AS function from UnrealScript in this way. For example:

      ActionScript Function To Call:

      Code:
      public function MyActionScriptFunc(param1:String,param2:Object):Void
      {
           // Do something awesome!
      }
      UnrealScript Function That Makes the Call:

      Code:
      function CallMyActionScriptFunc(string Param1, GFxObject Param2)
      {
           ActionScriptVoid("MyActionScriptFunc"); // Passes the parameters above (string Param1, & GFxObject Param2) as arguments
      }
      You would then call this UnrealScript function like so:

      Code:
      CallMyActionScriptFun("blah blah blah", someObject);
      But, if you must, you can use Invoke.

      See for more info: http://udn.epicgames.com/Three/Scale...0_UnrealScript

      Comment

      Working...
      X