flash - intercept all buttons clicks -


my question is:

is there way can intercept button click event in flex(air) app, because need add sound when button clicked, , dont want go on screens , add function , change each click event in each button.

so there way can this?

thanks!

it depends on specific site structure how easy might this. buttons have own unique class, or otherwise share distinguishing feature (a common hungarian style _btn marker in instance names)? if so, try this:

root.addeventlistener(mouseevent.click, onbuttonclickplaysound); private function onbuttonclickplaysound(e:mouseevent):void{     if(e.target extendedbutton){         // play sound here...     }      // or....      if(e.target.name.indexof("hungariannotation") >= 0){         // play sound here...     } } 

this won't work if handlers down display list stop event propagation. mouse clicks must bubble way root.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -