Announcement

Collapse
No announcement yet.

AS3 problem with unrealScript

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

    #16
    ActionScriptVoid() must be called from a class that extends GFxMoviePlayer. This class must have a SWF associated with it via MovieInfo. That is the SWF it will look for the function in.

    If you want a return value, use one of the other function calls:

    ActionScriptInt()
    ActionScriptString()
    ActionScriptArray()
    ActionScriptObject()

    etc...

    So, you would do something like:

    UnrealScript

    Code:
    function GetRetValueOfASFunction()
    {
        local string retVal;	
        retVal = CallASFunction("someString", 38);
    	
        `log("retVal: " @ retVal);
    }
    
    function string CallASFunction(string param1, int param2)
    {
        // AS2 Version
        return GetVariableObject("_root").ActionScriptString("MyASFunction");
    
        // AS3 version
        return GetVariableObject("root").ActionScriptString("MyASFunction");
    }
    ActionScript

    Code:
    function MyASFunction(param1:String, param2:int):String
    {
        var someString:String = "This is a test.";
    
        return someString;
    }

    Comment


      #17
      Of course GFxMoviePlayer only has one main GFxValue right?

      I didn't see those methods in the docs earlier but it certainly makes sense to have a full set, looks great.

      I'd still like to know how you avoid an invoke, even with complex objects you need an invoke.

      Comment


        #18
        I'm not really sure what you're asking about GFxValue. As for avoiding the use of invoke, I rarely use it. You'll have to provide an example of where you think you have to use it.

        Comment


          #19
          Here's another working group of functions to get a return value from an ActionScript Function:

          Code:
          function GetRetValueOfASFunction()
          {
              local array<GFxObject> retVal;	
              retVal = CallASFunction();
          	
              `log("Array Element 0 Return Value: " @ retVal[0].GetString("Name") @ " | " @ retVal[0].GetString("Type"));
              `log("Array Element 1 Return Value: " @ retVal[1].GetString("Name") @ " | " @ retVal[1].GetString("Type"));
          }
          
          function array<GFxObject> CallASFunction()
          {
              return RootMC.ActionScriptArray("MyASFunction");
          }
          ActionScript

          Code:
          function MyASFunction():Array
          {
              var retVal:Array = []
              retVal = [{Name: "Testing", Type: "String"},
          	      {Name: "Testing 2", Type: " Float"}];
              return retVal;
          }

          Comment


            #20
            Sorry, I meant that the GFxMoviePlayer class only has one movie.

            As for avoiding invoke, surely the scaleform code behind the unrealscript wrapper has to call an invoke at some point deeper down in the code

            Comment


              #21
              Ah yes - there is only one movie, but that movie can load sub movies. I couldn't tell you what's going on in the guts of Scaleform or Unreal though. That's beyond my knowledge.

              Comment

              Working...
              X