Actionscript / Flex: a question about handleAllEvents() method.
- by Patrick
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