on() 33
on()
Availability
Flash Lite 1.0.
Usage
on(event) {
// statement(s)
}
Operands
statement(s) The instructions to execute when event occurs.
event This trigger is called an event. When a user event occurs, the statements following it
within curly braces (
{}) execute. Any of the following values can be specified for the
event parameter:
■ press The button is pressed while the pointer is over the button.
■ release The button is released while the pointer is over the button.
■ rollOut The pointer rolls outside the button area.
■ rollOver The pointer rolls over the button.
■ keyPress "key" The specified key is pressed. For the key portion of the parameter,
specify a key code or key constant.
Description
Event handler; specifies the user event or keypress that triggers a function. Not all events
are supported.
Example
The following code, which scrolls the myText field down one line when the user presses the
8 key, tests against
maxscroll before scrolling:
on (keyPress "8") {
if (myText.scroll < myText.maxscroll) {
myText.scroll++;
}
}