Results 1 to 4 of 4
  1. #1
    MSgt. Shooter Person
    Join Date
    Mar 2012
    Posts
    56

    Default Reading a pre-existing integer from unrealscript to as2.

    Hello, I've been reading up on the tutorials on how to pull an unrealscript variable and read it in actionscript, but unfortunately, I still can't quite get the hang of this.

    In one of my uscript classes, there is a simple integer variable that I need my actionscript to recognize. I'm just getting a little tangled up in the uscript side of things. If I want actionscript to call an externalinterface call, in uscript, do I have to create some sort of function to "push" my integer out?

    Any help or sample code would be greatly appreciated.

  2. #2
    MSgt. Shooter Person
    Join Date
    Jul 2011
    Posts
    56

    Default

    ExteranlInterface is rather limited and clunky to use regarding return values. If you absolutely HAVE to make the call from actionscript, this is how I'd do it.

    AS
    Code:
    function makeCall():Void
    {
          ExternalInterface.call('sendUScriptVar'); 
    }
    function receiveVar( val:Number ):Void
    {
         // do stuff with val
    }

    UnrealScript (This would be in the GFxMoviePlayer class you set up to host the UI)
    Code:
    var int Value;
    
    function sendUScriptVar() // function can be parameterized, look at UDN Scaleform reference
    {
         SendVar(Value); // Where value is the predefined var u wanted
    }
    function SendVar(int val)
    {
         ActionScriptVoid("receiveVar"); // AS2
         ActionScriptVoid("_root.receiveVar") // AS3
    }

    For more information, or a better explaination, look at the technical reference
    http://udn.epicgames.com/Three/Scale...icalGuide.html

  3. #3
    MSgt. Shooter Person
    Join Date
    Mar 2012
    Posts
    56

    Default

    Okay, thanks a lot for the response. My value would be out in a different class, how would I reference it in the uscript damp,e you provided.

    But you make it sound like there are other options. What wod you recommend?

  4. #4
    MSgt. Shooter Person
    Join Date
    Jul 2011
    Posts
    56

    Default

    Quote Originally Posted by RP_Games View Post
    Okay, thanks a lot for the response. My value would be out in a different class, how would I reference it in the uscript damp,e you provided.

    But you make it sound like there are other options. What wod you recommend?
    I never make calls from ActionScript. All my update logic stays with UScript.
    Well, I shouldn't say "never" I register event handlers, but even that happens with GFxWidgets on the UScript side.

    You understand how to create and display the GFxUI from UScript right?

    Every Actor has an "Owner" variable, and the HUD class has a PlayerOwner variable that links to the PlayerController that owns it.
    You use those variables to get to your sensitive data.


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.