“Be inspired, enjoy your work, keep learning and never forget to play.” — gskinner

Global Mouse_Down Event

Posted: March 29th, 2008 | Author: Ivan Valadares | Filed under: Actionscript3, Code, WorkAround | 4 Comments »

A time ago I had I little problem, I was doing an application and it had some severed changes, at some point I hasn’t capable of detect some mouse down events because I had a lot of sprites inside of sprites inside of movieClips with lots of event listeners and so on. So I and Hugo found this solution. Basically you put a generic mouse down event on stage and pass an array of objects with the name of the display object you want to catch the event and the name of the function you want to call. One good thing is that you can catch more than one event at the same time even if the displayObjects are in front of another displayObjects.

Note: this is really bad programming, if you can don’t use it, use only in severe cases.

globalmousedown.swf

globalmousedown.zip


4 Comments on “Global Mouse_Down Event”

  1. 1 bong said at 7:11 am on May 10th, 2008:

    Thanks for this.. What if there is more than 2 buttons … should it still be an array or Object instead? what is the best solution?

  2. 2 Ivan Valadares said at 6:05 pm on May 10th, 2008:

    you should add more display objects/functions to objectsFunctions.
    examples:

    var objectsFunctions:Array = new Array({name:”button1″,functionName:”button1Click”},
    {name:”button2″,functionName:”button2Click”},
    {name:”button_Up”,functionName:”buttonUp_click”},{name:”ball”,functionName:”ballClick”});

  3. 3 Score check Credit said at 1:37 am on December 19th, 2008:

    how Score Credit Credit good Score

  4. 4 Olivia said at 10:27 pm on March 20th, 2009:

    I don


Leave a Reply