Global Mouse_Down Event

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

2 Responses to “Global Mouse_Down Event”

  1. bong Says:

    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. Ivan Valadares Says:
    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”});

Leave a Reply