Announcement

Collapse
No announcement yet.

actionscript clickhandling vs unreal clickhanding

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

    actionscript clickhandling vs unreal clickhanding

    What is the difference about where you do the eventlistener?

    In Actionscript:

    Code:
    ...addEventListener(MouseEvent.CLICK,as_fct);
    function as_fct(MouseEvent e):void
    {
    ExternalInterface.call(unreal_fct);
    }
    vs in Unrealscript:

    Code:
    ...AddEventListener('CLIK_click',unreal_fct);
    function unreal_fct(EventData data)
    {
    ...
    }
    Is any method preferable?

    #2
    I would assume that Unrealscript's AddEventListener only works for CLIK Widgets although I could be wrong, but if it does then using a movieclip that isn't a CLIK component may not work with this function I've never wanted to try this function mainly because AS3's addeventlistener's works. The main thing I avoid doing on actionscript is executing things per-frame - ENTER_FRAME for AS3 and should be onEnterFrame for AS2 I avoid both of those and choose to handle per-frame code on Unrealscript, by creating a child class of GFxMoviePlayer and calling a function that performs per-frame "checks" from PlayerTick. Also parameters on AS3 are not written the same way than those on Unrealscript, the name is before the data type/object separated by a colon, also it's a good idea to remove the event listener once you're done with it.

    Code:
    import flash.events.*;
    
    ObjectName.addEventListener( MouseEvent.CLICK, FunctionName );
    
    function FunctionName( e:MouseEvent ):void
    {
    	//script/code to be executed
    	ObjectName.removeEventListener( MouseEvent.CLICK, FunctionName );
    }
    ObjectName refers to the instance name of a MovieClip.

    Comment

    Working...
    X