Announcement

Collapse
No announcement yet.

simple button for as2 event trigger help

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

  • replied
    Same thing. The only difference is that the version I gave you is for the Adobe Flash IDE, whereas you are using FlashDevelop to write your code.

    Leave a comment:


  • replied
    The Actionscript2 didn't work on it. For this one.

    Code:
    function MyActionScriptFunction(param1:String, param2:Int):Void
    {
        trace("Param1: " + param1);
        trace("Param2: " + param2);
    }
    This method work for Actionscript2.
    Code:
    _root.MyActionScript = function (param1:String, param2:int){
    trace(param1);
    trace(param2);
    }
    As for unreal script.
    Code:
    class ... extends GFxMoviePlayer;
    
    ...
    function MyUnrealFunction(string param1,int param2){
    
      ActionScriptVoid("_root.MyActionScript");
    }

    Leave a comment:


  • replied
    To fire an ActionScript function from UnrealScript use:

    Code:
    function MyUnrealFunction(string param1, int param2)
    {
        ActionScriptVoid("MyActionScriptFunction");
    }
    The ActionScript Function:

    Code:
    function MyActionScriptFunction(param1:String, param2:Int):Void
    {
        trace("Param1: " + param1);
        trace("Param2: " + param2);
    }
    There are other return types you can call from UnrealScript as well:

    ActionScriptInt
    ActionScriptArray
    ActionScriptFloat
    ActionScriptObject
    ActionScriptString

    Leave a comment:


  • replied
    That help. Is there way to do same in unreal. To pass the unreal script to actionscript2 flash .swf file?

    Leave a comment:


  • replied
    If you are not using CLIK, but creating your own button, try this ActionScript (2.0) code:

    Code:
    import flash.external.ExternalInterface
    
    myButton.onRelease = function()
    {
        trace("myButton has been clicked.")
        ExternalInterface.call("ButtonClick");
    }
    Then in UnrealScript, you simply have the function "ButtonClick"

    Code:
    function ButtonClik()
    {
        `log("myButton click was intercepted by UnrealScript.");
    }

    Leave a comment:


  • replied
    I don't understand how it works. Is your code actionscript 2 or 3? Need an example of the actionscript2 and unrealscript to see how it triggers.

    Leave a comment:


  • replied
    Okay, but the code I provided should still work as long as you create the button with:

    attachMovie( "Button", "myButton1", 1 )

    Or something in that fashion.

    Leave a comment:


  • replied
    I am only scripting them. I am using the FlashDevelop program that is pure coding into actionscript 2. There no editor that I used as a button for them from .fla file.

    Leave a comment:


  • replied
    Originally posted by darknet View Post
    I wanted to create components in actionscript2. Just the basic coding in the components.
    Uhuh...I'm still not getting it, why do you want to create your own component instead of using CLIK?

    The following code will set up a button to do an action when it is clicked. Note that in order for it to work you have to copy the component to your projects library and drag an instance of it out to your scene and name it "myButton1"

    AS Code:

    Code:
    function doStuffOnClick( e )
    {
        trace( "the buttons label is: " + e.target.label );
        ExternalInterface.call( "FunctionInUnreal", e.target.data );
    }
    
    myButton1.addEventListener( "click", this, "doStuffOnClick" );
    
    stop();
    The function "doStuffOnClick" is executed when the specified button is clicked. And what the function does is write the label property of the button to the console and also calls the function "FunctionInUnreal" in unreal script. The function gets one parameter and that is the data that the button holds. I use this in my level selection scene to pass on the level that should be opened.

    Did this clear anything up or am I completely misunderstanding what you are asking for?

    Leave a comment:


  • replied
    I wanted to create components in actionscript2. Just the basic coding in the components.

    Originally posted by sidstyler View Post
    And what do you want to do with the button? Do you want to call an unreal script function when the button is pressed?
    I want a function or listener to trigger an event to change a variable or close menu. To update what ever I doing in flash to unreal script.

    Leave a comment:


  • replied
    Not quite sure I understand you, are you using the CLIK components to create a button or have you created your own component?

    And what do you want to do with the button? Do you want to call an unreal script function when the button is pressed?

    Leave a comment:


  • started a topic simple button for as2 event trigger help

    simple button for as2 event trigger help

    I am not sure how to code the event trigger to get it working with unreal script. How I get the code working in actionscript2 only to work with the editor?
Working...
X