Actionscript / Flex: a question about handleAllEvents() method.
        Posted  
        
            by Patrick
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Patrick
        
        
        
        Published on 2010-04-07T19:01:00Z
        Indexed on 
            2010/04/07
            19:03 UTC
        
        
        Read the original article
        Hit count: 211
        
actionscript-3
|flex
Hi,
in Adobe tutorials, they suggest to create a class to handle the events (see below the copy/pasted code, and link to page).
I was wondering if I have to handle all events with the function handleAllEvents, using if statements to check if the target is the one I want, and the event is the one I want.
i.e. if (event.type=="click") && (event.currentTarget == "myId")
Should I have a list of ifs (for each target and each event type ?)
thanks
// events/MyStaticEventHandler.as
package { // Empty package.
    import flash.events.Event;
    import mx.controls.Alert;
    public class MyStaticEventHandler {
        public function MyStaticEventHandler() {
            // Empty constructor.
        }
        public static function handleAllEvents(event:Event):void {
            Alert.show("Some event happened.");
        }
    }
}
Link (at the bottom): http://livedocs.adobe.com/flex/3/html/help.html?content=events_05.html
© Stack Overflow or respective owner