![MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference Download Page 85](http://html.mh-extra.com/html/macromedia/flash-8-actionscript-2-0-language/flash-8-actionscript-2-0-language_reference_687537085.webp)
Global Functions
85
Example
The following example uses
onClipEvent()
with the
keyDown
movie event and is designed to
be attached to a movie clip or button. The
keyDown
movie event is usually used with one or
more methods and properties of the Key object. The following script uses
Key.getCode()
to
find out which key the user has pressed; if the pressed key matches the
Key.RIGHT
property,
the playhead is sent to the next frame; if the pressed key matches the
Key.LEFT
property, the
playhead is sent to the previous frame.
onClipEvent (keyDown) {
if (Key.getCode() == Key.RIGHT) {
this._parent.nextFrame();
} else if (Key.getCode() == Key.LEFT) {
this._parent.prevFrame();
}
}
The following example uses
onClipEvent()
with the
load
and
mouseMove
movie events.
The _
xmouse
and _
ymouse
properties track the position of the mouse each time the mouse
moves, which appears in the text field that's created at runtime.
onClipEvent (load) {
this.createTextField("coords_txt", this.getNextHighestDepth(), 0, 0, 100,
22);
coords_txt.autoSize = true;
coords_txt.selectable = false;
}
onClipEvent (mouseMove) {
coords_txt.text = "X:"+_root.",Y:"+_root._ymouse;
}
See also
Key
,
_xmouse (MovieClip._xmouse property)
,
_ymouse (MovieClip._ymouse
property)
,
on handler
,
updateAfterEvent function
ord function
ord(character:String) : Number
Deprecated
since Flash Player 5. This function was deprecated in favor of the methods and
properties of the String class.
Converts characters to ASCII code numbers.
Availability:
ActionScript 1.0; Flash Player 4
Parameters
character
:String
- The character to convert to an ASCII code number.
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...