MACROMEDIA FLASH 8-COMPONENTS LANGUAGE Reference page 1134

Components language reference
Table of Contents

Advertisement

The second usage example uses an
component instance. The keyword
component, refers to the component instance. For example, the following code, attached to
the Button component instance
to the Output panel:
on (click) {
trace(this);
}
The behavior of
this
regular Flash button symbol; in this instance,
example, the following code, attached to the button symbol instance
"_level0" to the Output panel:
on (release) {
trace(this);
}
The built-in ActionScript Button object doesn't have a
is
.
release
Example
This example, written on a frame of the timeline, sends a message to the Output panel when a
button called
buttonInstance
toggle switch. The second line creates a listener object called
function for the
click
that uses the event object that is automatically passed to the function (in this example,
) to generate a message. The
eventObj
that generated the event (in this example,
property is accessed from the event object's
addEventListener()
listener object as parameters.
buttonInstance.toggle = true;
var form:Object = new Object();
form.click = function(eventObj:Object) {
trace("The selected property has changed to " +
eventObj.target.selected);
};
buttonInstance.addEventListener("click", form);
1130
SimpleButton class
handler and must be attached directly to a Button
on()
, used inside an
this
myButtonComponent
is different when used inside an
is clicked. The first line specifies that the button act like a
event on the listener object. Inside the function is a
target
buttonInstance
from
buttonInstance
handler attached to a
on()
, sends "_level0.myButtonComponent"
handler that is attached to a
on()
refers to the that contains the button. For
this
click
form
property of an event object is the component
). The
property. The last line calls
target
and passes it the
click
, sends
myButton
event; the closest event
. The third line defines a
statement
trace()
SimpleButton.selected
event and the
form

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash 8

Table of Contents