![]() ![]() | |
The easiest way to handle a component event is to use the on() component event handler. You can assign the on() handler to a component instance, just as you would assign a handler to a button or movie clip.
The keyword this, used inside an on() handler attached to a component, refers to the component instance. For example, the following code, attached to the Button component instance myButtonComponent, sends "_level0.myButtonComponent" to the Output panel:
on(click){
trace(this);
}
To use the on() handler:
on(click){
trace("CheckBox was clicked");
}
You can enter any code you wish between the curly braces({}).
For more information, see each event entry in Components Dictionary.
![]() ![]() | |