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.
May 10th, 2008 at 7:11 am
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?
May 10th, 2008 at 6:05 pm
examples:
var objectsFunctions:Array = new Array({name:”button1″,functionName:”button1Click”},
{name:”button2″,functionName:”button2Click”},
{name:”button_Up”,functionName:”buttonUp_click”},{name:”ball”,functionName:”ballClick”});