dcsimg
A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: AS3 pass arguments in addEventListener

Threaded View

  1. #1
    Member
    Join Date
    Nov 2004
    Location
    London, Covent Garden
    Posts
    78

    AS3 pass arguments in addEventListener

    Hi, i gather it's not possible to send arguments from Mouse Events without writing a custom EventManager. What would be a correct way to identify either the object sending the event or to pass arguments to a function specified in the Mouse Event?

    I discovered this but I'm not sure if it's appropriate since i'm not familiar yet with EventManager/Dispatch stuff, I don't know what I'm looking for:
    http://www.kirupa.com/forum/showthread.php?t=291250

    Hypothetical:
    I have a function which receives a MovieClip object then adds a listener to it - I want to then pass the same object onto the next function if the object receives a mouse click.

    Code:
    //ADD EVENT LISTENERS
    public static function addFirstClickListener(myButton:MovieClip) {
    	myButton.addEventListener(MouseEvent.CLICK, doSomething(myButton));
    }

    PS: trace for "myButton" turns out correctly
    button passed is [object news]
    Last edited by bosie; 05-31-2008 at 03:14 PM.
    bosie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center