Macromedia Flash ActionScript - MX 2004 User Guide

ActionScript Language Reference
Trademarks
Add Life to the Web, Afterburner, Aftershock, Andromedia, Allaire, Animation PowerPack, Aria, Attain, Authorware, Authorware Star, Backstage, Bright Tiger, Clustercats, ColdFusion, Contribute, Design In Motion, Director, Dream Templates, Dreamweaver, Drumbeat 2000, EDJE, EJIPT, Extreme 3D, Fireworks, Flash, Flash Lite, Flex, Fontographer, FreeHand, Generator, HomeSite, JFusion, JRun, Kawa, Know Your Site, Knowledge Objects, Knowledge Stream, Knowledge Track, LikeMinds, Lingo, Live Effects, MacRecorder Logo and Design, Macromedia, Macromedia Action!, Macromedia Breeze, Macromedia Flash, Macromedia M Logo and Design, Macromedia Spectra, Macromedia xRes Logo and Design, MacroModel, Made with Macromedia, Made with Macromedia Logo and Design, MAGIC Logo and Design, Mediamaker, Movie Critic, Open Sesame!, Roundtrip, Roundtrip HTML, Shockwave, Sitespring, SoundEdit, Titlemaker, UltraDev, Web Design 101, what the web can be, and Xtra are either registered trademarks or trademarks of Macromedia, Inc. and may be registered in the United States or in other jurisdictions including internationally. Other product names, logos, designs, titles, words, or phrases mentioned within this publication may be trademarks, service marks, or trade names of Macromedia, Inc. or other entities and may be registered in certain jurisdictions including internationally.
Third-Party Information
This guide contains links to third-party websites that are not under the control of Macromedia, and Macromedia is not responsible for the content on any linked site. If you access a third-party website mentioned in this guide, then you do so at your own risk. Macromedia provides these links only as a convenience, and the inclusion of the link does not imply that Macromedia endorses or accepts any responsibility for the content on those third-party sites.
Speech compression and decompression technology licensed from Nellymoser, Inc. (www.nellymoser.com).
Sorenson™ Spark™ video compression and decompression technology licensed from Sorenson Media, Inc.
Opera ® browser Copyright © 1995-2002 Opera Software ASA and its suppliers. All rights reserved.
Apple Disclaimer
APPLE COMPUTER, INC. MAKES NO WARRANTIES, EITHER EXPRESS OR IMPLIED, REGARDING THE ENCLOSED COMPUTER SOFTWARE PACKAGE, ITS MERCHANTABILITY OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. THE EXCLUSION OF IMPLIED WARRANTIES IS NOT PERMITTED BY SOME STATES. THE ABOVE EXCLUSION MAY NOT APPLY TO YOU. THIS WARRANTY PROVIDES YOU WITH SPECIFIC LEGAL RIGHTS. THERE MAY BE OTHER RIGHTS THAT YOU MAY HAVE WHICH VARY FROM STATE TO STATE.
Copyright © 2004 Macromedia, Inc. All rights reserved. This manual may not be copied, photocopied, reproduced, translated, or converted to any electronic or machine-readable form in whole or in part without prior written approval of Macromedia, Inc.
Acknowledgments
Director: Erick Vera
Project Management: Julee Burdekin, Erick Vera
Writing: Jay Armstrong, Jody Bleyle, Mary Burger, Francis Cheng, Jen deHaan, Stephanie Gowin, Phillip Heinz, Shimul Rahim, Samuel R. Neff
Managing Editor: Rosana Francescato
Editing: Mary Ferguson, Mary Kraemer, Noreen Maher, Antonio Padial, Lisa Stanziano, Anne Szabla, Barbara Milligan
Production Management: Patrice O’Neill
Media Design and Production: Adam Barnett, Christopher Basmajian, Aaron Begley, John Francis
Second Edition: June 2004 Macromedia, Inc.
600 Townsend St. San Francisco, CA 94103

CONTENTS

CHAPTER 1: Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Sample entry for most ActionScript elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Sample entry for classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Examples Folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
CHAPTER 2: ActionScript Language Reference . . . . . . . . . . . . . . . . . . . . . . . . . 25
–– (decrement) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
++ (increment) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
! (logical NOT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
!= (inequality) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
!== (strict inequality) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
% (modulo). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
%= (modulo assignment) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
& (bitwise AND) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
&& (logical AND) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
&= (bitwise AND assignment) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
() (parentheses) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
– (minus) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
* (multiplication) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
*= (multiplication assignment) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
, (comma) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
. (dot) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
: (type) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
?: (conditional) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
/ (division). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
// (comment delimiter) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
/* (comment delimiter) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
/= (division assignment) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
[] (array access) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
^ (bitwise XOR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
^= (bitwise XOR assignment) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
{} (object initializer). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
| (bitwise OR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
|| (logical OR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
|= (bitwise OR assignment) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
~ (bitwise NOT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
3
+ (addition) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
+= (addition assignment) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
< (less than). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
<< (bitwise left shift) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
<<= (bitwise left shift and assignment). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
<= (less than or equal to) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
= (assignment) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
-= (subtraction assignment) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
== (equality) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
=== (strict equality) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
> (greater than) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
>= (greater than or equal to) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
>> (bitwise right shift) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
>>= (bitwise right shift and assignment) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
>>> (bitwise unsigned right shift) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
>>>= (bitwise unsigned right shift and assignment) . . . . . . . . . . . . . . . . . . . . . . . . 91
Accessibility class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Accessibility.isActive() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Accessibility.updateProperties() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
_accProps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
arguments object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
arguments.callee . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
arguments.caller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
arguments.length. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Array(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Array class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Array.concat() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Array.join() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Array.length. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Array.pop() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Array.push() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Array.reverse() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Array.shift() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Array.slice() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Array.sort() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Array.sortOn() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Array.splice() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Array.toString() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Array.unshift() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
asfunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Boolean(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Boolean class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Boolean.toString(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Boolean.valueOf() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
break . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Button class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Button._alpha . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Button.enabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Button._focusrect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Button.getDepth(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
4 Contents
Button._height . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Button.menu. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Button._name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Button.onDragOut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Button.onDragOver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Button.onKeyDown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Button.onKeyUp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
Button.onKillFocus. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Button.onPress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Button.onRelease . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Button.onReleaseOutside . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Button.onRollOut. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Button.onRollOver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Button.onSetFocus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Button._parent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Button._quality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Button._rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Button._soundbuftime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Button.tabEnabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Button.tabIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Button._target. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Button.trackAsMenu. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Button._url . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Button.useHandCursor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
Button._visible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Button._width. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
Button._x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Button._xmouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Button._xscale. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Button._y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Button._ymouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Button._yscale. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
Camera class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Camera.activityLevel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Camera.bandwidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Camera.currentFps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Camera.fps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
Camera.get() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Camera.height. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Camera.index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Camera.motionLevel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
Camera.motionTimeOut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Camera.muted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Camera.name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Camera.names. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Camera.onActivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Camera.onStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
Camera.quality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Camera.setMode(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Camera.setMotionLevel() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Contents 5
Camera.setQuality() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
Camera.width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
clearInterval() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
Color class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Color.getRGB(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Color.getTransform(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Color.setRGB() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Color.setTransform() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
ContextMenu class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
ContextMenu.builtInItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
ContextMenu.copy(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
ContextMenu.customItems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
ContextMenu.hideBuiltInItems() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
ContextMenu.onSelect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
ContextMenuItem class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
ContextMenuItem.caption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
ContextMenuItem.copy() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
ContextMenuItem.enabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
ContextMenuItem.onSelect. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
ContextMenuItem.separatorBefore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
ContextMenuItem.visible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
continue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
CustomActions class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
CustomActions.get() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
CustomActions.install(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
CustomActions.list() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
CustomActions.uninstall(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Date class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Date.getDate() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Date.getDay() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
Date.getFullYear() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Date.getHours() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Date.getMilliseconds() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Date.getMinutes() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Date.getMonth() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Date.getSeconds() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Date.getTime() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Date.getTimezoneOffset(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
Date.getUTCDate() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Date.getUTCDay() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Date.getUTCFullYear() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Date.getUTCHours() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
Date.getUTCMilliseconds() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Date.getUTCMinutes(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
Date.getUTCMonth(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
Date.getUTCSeconds() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
Date.getYear() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
Date.setDate() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
6 Contents
Date.setFullYear() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
Date.setHours(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
Date.setMilliseconds(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Date.setMinutes() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Date.setMonth() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
Date.setSeconds() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
Date.setTime() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
Date.setUTCDate(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
Date.setUTCFullYear() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Date.setUTCHours() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
Date.setUTCMilliseconds(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
Date.setUTCMinutes() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
Date.setUTCMonth() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Date.setUTCSeconds() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
Date.setYear() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
Date.toString() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
Date.UTC() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
default. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
delete. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
do while . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
duplicateMovieClip() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
dynamic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
else . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
else if . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
#endinitclip. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Error class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Error.message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
Error.name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
Error.toString() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
escape() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
eval() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
extends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
false. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
_focusrect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
for..in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
fscommand() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
Function class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
Function.apply() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Function.call(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
getProperty() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
getTimer(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
getURL(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
getVersion(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
_global object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
gotoAndPlay() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
gotoAndStop() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
if . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
Contents 7
implements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
import. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
#include . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
Infinity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
#initclip. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
instanceof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
intrinsic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
isFinite() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
isNaN(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
Key class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
Key.addListener() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
Key.BACKSPACE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
Key.CAPSLOCK. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
Key.CONTROL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
Key.DELETEKEY. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
Key.DOWN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
Key.END . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
Key.ENTER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
Key.ESCAPE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
Key.getAscii() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
Key.getCode() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
Key.HOME. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
Key.INSERT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
Key.isDown() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
Key.isToggled() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
Key.LEFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
Key.onKeyDown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
Key.onKeyUp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
Key.PGDN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
Key.PGUP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
Key.removeListener(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
Key.RIGHT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
Key.SHIFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
Key.SPACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
Key.TAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Key.UP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
_level. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
loadMovie(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
loadMovieNum(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
loadVariables(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
loadVariablesNum(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
LoadVars class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
LoadVars.addRequestHeader() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
LoadVars.contentType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
LoadVars.decode() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
LoadVars.getBytesLoaded() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
LoadVars.getBytesTotal(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
LoadVars.load() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
LoadVars.loaded . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
8 Contents
LoadVars.onData. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
LoadVars.onLoad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
LoadVars.send(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
LoadVars.sendAndLoad() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
LoadVars.toString() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
LocalConnection class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
LocalConnection.allowDomain. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
LocalConnection.allowInsecureDomain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
LocalConnection.close() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
LocalConnection.connect() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
LocalConnection.domain() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
LocalConnection.onStatus. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
LocalConnection.send() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
Math class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
Math.abs(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
Math.acos() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
Math.asin() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
Math.atan(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
Math.atan2(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
Math.ceil() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
Math.cos(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
Math.E . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
Math.exp() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
Math.floor() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430
Math.log(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
Math.LN2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432
Math.LN10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
Math.LOG2E . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434
Math.LOG10E . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
Math.max() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436
Math.min() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
Math.PI. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438
Math.pow(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
Math.random() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440
Math.round() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441
Math.sin() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
Math.sqrt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
Math.SQRT1_2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444
Math.SQRT2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
Math.tan(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
Microphone class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
Microphone.activityLevel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449
Microphone.gain. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450
Microphone.get() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451
Microphone.index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453
Microphone.muted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454
Microphone.name. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
Microphone.names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456
Microphone.onActivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457
Microphone.onStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458
Contents 9
Microphone.rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
Microphone.setGain(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
Microphone.setRate() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462
Microphone.setSilenceLevel() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464
Microphone.setUseEchoSuppression(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466
Microphone.silenceLevel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468
Microphone.silenceTimeOut. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470
Microphone.useEchoSuppression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472
MMExecute() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
Mouse class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
Mouse.addListener() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
Mouse.hide(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478
Mouse.onMouseDown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479
Mouse.onMouseMove. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
Mouse.onMouseUp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
Mouse.onMouseWheel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
Mouse.removeListener() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486
Mouse.show() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488
MovieClip class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489
MovieClip._alpha . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494
MovieClip.attachAudio(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495
MovieClip.attachMovie() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497
MovieClip.beginFill() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498
MovieClip.beginGradientFill() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499
MovieClip.clear() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503
MovieClip.createEmptyMovieClip() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504
MovieClip.createTextField() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
MovieClip._currentframe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507
MovieClip.curveTo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508
MovieClip._droptarget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510
MovieClip.duplicateMovieClip(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511
MovieClip.enabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512
MovieClip.endFill(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513
MovieClip.focusEnabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514
MovieClip._focusrect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515
MovieClip._framesloaded . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516
MovieClip.getBounds() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517
MovieClip.getBytesLoaded() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519
MovieClip.getBytesTotal(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520
MovieClip.getDepth(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521
MovieClip.getInstanceAtDepth() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522
MovieClip.getNextHighestDepth() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523
MovieClip.getSWFVersion() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524
MovieClip.getTextSnapshot() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525
MovieClip.getURL() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527
MovieClip.globalToLocal() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528
MovieClip.gotoAndPlay() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530
MovieClip.gotoAndStop(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531
MovieClip._height . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532
MovieClip.hitArea. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533
10 Contents
MovieClip.hitTest() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534
MovieClip.lineStyle() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536
MovieClip.lineTo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537
MovieClip.loadMovie(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538
MovieClip.loadVariables() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
MovieClip.localToGlobal() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542
MovieClip._lockroot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543
MovieClip.menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546
MovieClip.moveTo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547
MovieClip._name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548
MovieClip.nextFrame(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549
MovieClip.onData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550
MovieClip.onDragOut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552
MovieClip.onDragOver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553
MovieClip.onEnterFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554
MovieClip.onKeyDown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555
MovieClip.onKeyUp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
MovieClip.onKillFocus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558
MovieClip.onLoad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559
MovieClip.onMouseDown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561
MovieClip.onMouseMove. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 562
MovieClip.onMouseUp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563
MovieClip.onPress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564
MovieClip.onRelease. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
MovieClip.onReleaseOutside . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566
MovieClip.onRollOut. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567
MovieClip.onRollOver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568
MovieClip.onSetFocus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569
MovieClip.onUnload . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570
MovieClip._parent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571
MovieClip.play(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 572
MovieClip.prevFrame() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
MovieClip._quality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574
MovieClip.removeMovieClip() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575
MovieClip._rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576
MovieClip.setMask(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577
MovieClip._soundbuftime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578
MovieClip.startDrag(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579
MovieClip.stop(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580
MovieClip.stopDrag() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581
MovieClip.swapDepths(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582
MovieClip.tabChildren . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583
MovieClip.tabEnabled. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584
MovieClip.tabIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585
MovieClip._target . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586
MovieClip._totalframes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587
MovieClip.trackAsMenu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588
MovieClip.unloadMovie(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589
MovieClip._url . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590
MovieClip.useHandCursor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591
Contents 11
MovieClip._visible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592
MovieClip._width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593
MovieClip._x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594
MovieClip._xmouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595
MovieClip._xscale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596
MovieClip._y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597
MovieClip._ymouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598
MovieClip._yscale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599
MovieClipLoader class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600
MovieClipLoader.addListener() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 602
MovieClipLoader.getProgress() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603
MovieClipLoader.loadClip() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604
MovieClipLoader.onLoadComplete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607
MovieClipLoader.onLoadError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 609
MovieClipLoader.onLoadInit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611
MovieClipLoader.onLoadProgress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613
MovieClipLoader.onLoadStart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615
MovieClipLoader.removeListener() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 617
MovieClipLoader.unloadClip() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619
NaN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 620
-Infinity. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621
NetConnection class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 622
NetConnection.connect() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624
NetStream class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625
NetStream.bufferLength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 627
NetStream.bufferTime. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628
NetStream.bytesLoaded. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629
NetStream.bytesTotal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631
NetStream.close() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633
NetStream.currentFps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 634
NetStream.onStatus. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635
NetStream.pause(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637
NetStream.play(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638
NetStream.seek(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 640
NetStream.setBufferTime() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
NetStream.time. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 642
new . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 643
newline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 644
nextFrame(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645
nextScene() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 646
null . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 647
Number() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 648
Number class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 650
Number.MAX_VALUE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 652
Number.MIN_VALUE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 653
Number.NaN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 654
Number.NEGATIVE_INFINITY. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 655
Number.POSITIVE_INFINITY. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 656
Number.toString(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 657
Number.valueOf() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 658
12 Contents
Object() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 659
Object class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 660
Object.addProperty() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 662
Object.constructor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665
Object.__proto__ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 666
Object.registerClass() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 667
Object.__resolve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668
Object.toString(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 672
Object.unwatch() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 674
Object.valueOf() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 675
Object.watch() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676
on() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 678
onClipEvent() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680
onUpdate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682
_parent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 684
parseFloat() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685
parseInt(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 686
play(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688
prevFrame(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689
prevScene() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690
print() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691
printAsBitmap() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 693
printAsBitmapNum() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695
PrintJob class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697
PrintJob.addPage() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699
PrintJob.send() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 703
PrintJob.start() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 704
printNum(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706
private . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707
public . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 709
_quality. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710
removeMovieClip() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711
return . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 712
_root . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713
Selection class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714
Selection.addListener() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715
Selection.getBeginIndex() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 716
Selection.getCaretIndex() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717
Selection.getEndIndex() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718
Selection.getFocus(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 720
Selection.onSetFocus. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 721
Selection.removeListener(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723
Selection.setFocus(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724
Selection.setSelection() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726
set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 727
set variable. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729
setInterval() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731
setProperty() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734
SharedObject class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735
SharedObject.clear() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737
Contents 13
SharedObject.data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 738
SharedObject.flush() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 740
SharedObject.getLocal() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 742
SharedObject.getSize() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 745
SharedObject.onStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746
Sound class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 748
Sound.attachSound(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 750
Sound.duration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 751
Sound.getBytesLoaded() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 753
Sound.getBytesTotal() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 755
Sound.getPan() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 756
Sound.getTransform() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 758
Sound.getVolume() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 760
Sound.id3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 762
Sound.loadSound() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 765
Sound.onID3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 766
Sound.onLoad. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 767
Sound.onSoundComplete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 768
Sound.position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 769
Sound.setPan() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 770
Sound.setTransform() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 771
Sound.setVolume() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773
Sound.start() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 774
Sound.stop() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 775
_soundbuftime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 776
Stage class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 777
Stage.addListener() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 778
Stage.align . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 779
Stage.height. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 780
Stage.onResize. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 781
Stage.removeListener() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 782
Stage.scaleMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 783
Stage.showMenu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 784
Stage.width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785
startDrag(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 786
static . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 787
stop(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 789
stopAllSounds(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 790
stopDrag(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791
String() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 792
String class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 793
String.charAt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 795
String.charCodeAt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796
String.concat(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 797
String.fromCharCode() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 798
String.indexOf() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 799
String.lastIndexOf(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 800
String.length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 801
String.slice() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 802
String.split() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 804
14 Contents
String.substr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 806
String.substring(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 807
String.toLowerCase(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 808
String.toUpperCase() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 809
" " (string delimiter) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 810
super . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 811
switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 813
System.capabilities object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 815
System.capabilities.avHardwareDisable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 817
System.capabilities.hasAccessibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 818
System.capabilities.hasAudio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 819
System.capabilities.hasAudioEncoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 820
System.capabilities.hasEmbeddedVideo. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 821
System.capabilities.hasMP3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 822
System.capabilities.hasPrinting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 823
System.capabilities.hasScreenBroadcast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 824
System.capabilities.hasScreenPlayback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 825
System.capabilities.hasStreamingAudio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 826
System.capabilities.hasStreamingVideo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 827
System.capabilities.hasVideoEncoder. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 828
System.capabilities.isDebugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 829
System.capabilities.language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 830
System.capabilities.localFileReadDisable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 832
System.capabilities.manufacturer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 833
System.capabilities.os . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 834
System.capabilities.pixelAspectRatio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 835
System.capabilities.playerType. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 836
System.capabilities.screenColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837
System.capabilities.screenDPI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 838
System.capabilities.screenResolutionX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 839
System.capabilities.screenResolutionY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 840
System.capabilities.serverString . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 841
System.capabilities.version. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 842
System.security object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 843
System.security.allowDomain() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 844
System.security.allowInsecureDomain(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 846
System.security.loadPolicyFile() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 848
System class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 850
System.exactSettings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 851
System.onStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 853
System.setClipboard() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 854
System.showSettings() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 855
System.useCodepage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 856
targetPath() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 857
TextField.StyleSheet class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 858
TextField.StyleSheet.clear() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 860
TextField.StyleSheet.getStyle() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 861
TextField.StyleSheet.getStyleNames() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 863
TextField.StyleSheet.load() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 864
TextField.StyleSheet.onLoad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 865
Contents 15
TextField.StyleSheet.parseCSS() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 866
TextField.StyleSheet.setStyle() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 867
TextField.StyleSheet.transform() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 869
TextField class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 870
TextField.addListener() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 873
TextField._alpha . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 875
TextField.autoSize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 876
TextField.background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 878
TextField.backgroundColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 879
TextField.border . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 880
TextField.borderColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 881
TextField.bottomScroll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 882
TextField.condenseWhite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 883
TextField.embedFonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 884
TextField.getDepth() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 885
TextField.getFontList() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 886
TextField.getNewTextFormat() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 887
TextField.getTextFormat() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 888
TextField._height. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 889
TextField.hscroll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 890
TextField.html . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 891
TextField.htmlText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 892
TextField.length. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 893
TextField.maxChars. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 894
TextField.maxhscroll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 895
TextField.maxscroll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 896
TextField.menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 897
TextField.mouseWheelEnabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 898
TextField.multiline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 899
TextField._name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 900
TextField.onChanged . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 901
TextField.onKillFocus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 902
TextField.onScroller. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 903
TextField.onSetFocus. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 905
TextField._parent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 906
TextField.password . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 907
TextField._quality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 908
TextField.removeListener() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 909
TextField.removeTextField() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 910
TextField.replaceSel(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 911
TextField.replaceText() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 912
TextField.restrict . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 913
TextField._rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 914
TextField.scroll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 915
TextField.selectable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 916
TextField.setNewTextFormat() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 917
TextField.setTextFormat() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 918
TextField.styleSheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 920
TextField.tabEnabled. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 922
TextField.tabIndex. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 923
16 Contents
TextField._target . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 925
TextField.text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 926
TextField.textColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 927
TextField.textHeight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 928
TextField.textWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 929
TextField.type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 930
TextField._url . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 931
TextField.variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 932
TextField._visible. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 933
TextField._width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 934
TextField.wordWrap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 935
TextField._x. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 936
TextField._xmouse. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 937
TextField._xscale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 938
TextField._y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 939
TextField._ymouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 940
TextField._yscale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 941
TextFormat class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 942
TextFormat.align . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 945
TextFormat.blockIndent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 946
TextFormat.bold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 947
TextFormat.bullet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 948
TextFormat.color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 949
TextFormat.font . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 950
TextFormat.getTextExtent(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 951
TextFormat.indent. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 954
TextFormat.italic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 955
TextFormat.leading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 956
TextFormat.leftMargin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 957
TextFormat.rightMargin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 958
TextFormat.size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 959
TextFormat.tabStops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 960
TextFormat.target . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 961
TextFormat.underline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 962
TextFormat.url . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 963
TextSnapshot object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 964
TextSnapshot.findText() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 965
TextSnapshot.getCount(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 966
TextSnapshot.getSelected() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 967
TextSnapshot.getSelectedText() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 968
TextSnapshot.getText() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 970
TextSnapshot.hitTestTextNearPos() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 972
TextSnapshot.setSelectColor() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 974
TextSnapshot.setSelected(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 976
this . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 978
throw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 980
trace() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 982
true . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 983
try..catch..finally . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 984
typeof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 988
Contents 17
undefined . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 989
unescape() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 991
unloadMovie(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 992
unloadMovieNum() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 993
updateAfterEvent() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 994
var . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 995
Video class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 996
Video.attachVideo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 997
Video.clear() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 998
Video.deblocking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 999
Video.height . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1000
Video.smoothing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1002
Video.width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1003
void. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1004
while . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1005
with. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1007
XML class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1009
XML.addRequestHeader() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1012
XML.appendChild() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1013
XML.attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1015
XML.childNodes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1016
XML.cloneNode(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1017
XML.contentType. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1019
XML.createElement() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1020
XML.createTextNode() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1021
XML.docTypeDecl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1023
XML.firstChild . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1024
XML.getBytesLoaded() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1026
XML.getBytesTotal() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1027
XML.hasChildNodes() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1028
XML.ignoreWhite. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1029
XML.insertBefore() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1031
XML.lastChild . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1032
XML.load() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1034
XML.loaded . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1036
XML.nextSibling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1037
XML.nodeName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1038
XML.nodeType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1040
XML.nodeValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1042
XML.onData. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1044
XML.onLoad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1045
XML.parentNode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1046
XML.parseXML() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1047
XML.previousSibling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1048
XML.removeNode() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1049
XML.send(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1050
XML.sendAndLoad() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1051
XML.status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1053
XML.toString() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1055
XML.xmlDecl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1056
18 Contents
XMLNode class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1058
XMLSocket class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1059
XMLSocket.close() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1061
XMLSocket.connect() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1062
XMLSocket.onClose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1064
XMLSocket.onConnect. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1065
XMLSocket.onData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1067
XMLSocket.onXML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1068
XMLSocket.send() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1069
APPENDIX: Deprecated Language Elements . . . . . . . . . . . . . . . . . . . . . . . . . . 1071
add . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1072
and . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1073
Button._highquality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1074
call() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1075
chr. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1076
eq (equal — string specific) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1077
ge (greater than or equal to — string specific) . . . . . . . . . . . . . . . . . . . . . . . . . . 1078
gt (greater than — string specific) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1079
_highquality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1080
<> (inequality). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1081
ifFrameLoaded . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1082
int . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1083
le (less than or equal to — string specific) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1084
length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1085
lt (less than — string specific) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1086
maxscroll. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1087
mbchr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1088
mblength. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1089
mbord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1090
mbsubstring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1091
MovieClip._highquality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1092
ne (not equal — string specific). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1093
not . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1094
or . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1095
ord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1096
random . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1097
scroll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1098
substring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1099
tellTarget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1100
TextField._highquality. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1102
toggleHighQuality() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1103
Contents 19
20 Contents
CHAPTER 1

Introduction

This manual describes the syntax and use of ActionScript elements in Macromedia Flash MX 2004 and Macromedia Flash MX Professional 2004. To use examples in a script, copy the code example from this book and paste it into the Script pane or into an external script file. The manual lists all ActionScript elements—operators, keywords, statements, actions, properties, functions, classes, and methods.
Note: The examples are written in ActionScript 2.0, and will be unlikely to compile if you have specified ActionScript 1.0 or Flash Player 5 or earlier in the Flash tab of your FLA file’s Publish Settings dialog box.
There are two types of entries in this manual:
Individual entries for operators, keywords, functions, variables, properties, methods,
and statements
Class entries, which provide general information about built-in classes
Use the information in the sample entries to interpret the structure and conventions used in these types of entries.
This chapter contains the following sections:
Sample entry for most ActionScript elements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Sample entry for classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Examples Folder. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

Sample entry for most ActionScript elements

The following sample entry explains the conventions used for all ActionScript elements that are not classes.

Entry title

Entries are listed alphabetically within a chapter. The alphabetization ignores capitalization, leading underscores, and so on.
21
Availability
Unless otherwise noted, the Availability section tells which versions of Flash Player support the element. The supported Flash Player version is not the same as the version of Flash used to author the content. For example, if you use Macromedia Flash MX 2004 or Macromedia Flash MX Professional 2004 to create content for Flash Player 6, you can use only ActionScript elements that are available to Flash Player 6.
In a few cases, this section also indicates which version of the authoring tool supports an element. For an example, see System.setClipboard().
If an element is supported only in ActionScript 2.0, that information is also noted in this section.
Usage
This section provides correct syntax for using the ActionScript element in your code. The required portion of the syntax is in information are in
italicized code font. Data types can be distinguished from code that you
provide by the colon (:) that always precedes data type information. Brackets (
code font. Both the code that you provide and data type
[]) indicate
optional parameters.
Parameters
This section describes any parameters listed in the syntax.
Returns
This section identifies what, if any, values the element returns.
Description
This section identifies the type of element (for example, operator, method, function, and so on) and then describes how to use the element.
Example
This section provides a code sample demonstrating how to use the element.
See also
This section lists related ActionScript dictionary entries.

Sample entry for classes

The following sample dictionary entry explains the conventions used for built-in ActionScript classes. .

Entry title

The entry title provides the name of the class. The class name is followed by general descriptive information.
22 Chapter 1: Introduction

Method and property summary tables

Each class entry contains a table listing all of the associated methods. If the class has properties (often constants), event handlers, or event listeners, these elements are summarized in additional tables. All the elements listed in these tables also have their own entries, which follow the class entry.

Constructor

If a class requires that you use a constructor to access its methods and properties, the constructor is described in each class entry. This description has all of the standard elements (usage, description, and so on) of other entries.

Method, property, and event handler listings

The methods, properties, and event handlers of a class are listed alphabetically after the class entry.

Examples Folder

A set of ActionScript example files can be found in the HelpExamples folder in the Flash installation directory. Typical paths to this folder are:
Windows: \Program Files\Macromedia\Flash MX 2004\Samples\HelpExamples\
Macintosh: HD/Applications/Macromedia Flash MX 2004/Samples/HelpExamples/
The HelpExamples folder contains a set of FLA files that are complete projects with working ActionScript code. All ActionScript code can be found in the main Timeline of each FLA file or in external ActionScript (.as) files.
Examples Folder 23
24 Chapter 1: Introduction
CHAPTER 2

ActionScript Language Reference

–– (decrement)
Availability
Flash Player 4.
Usage
––expression
expression––
Parameters
expression
Returns
A number.
Description
Operator (arithmetic); a pre-decrement and post-decrement unary operator that subtracts 1 from the
expression. The expression can be a variable, element in an array, or property of an object.
The pre-decrement form of the operator ( returns the result. The post-decrement form of the operator (
expression and returns the initial value of expression (the value prior to the subtraction). For
more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
A number or a variable that evaluates to a number.
––expression) subtracts 1 from expression and
expression––) subtracts 1 from the
Example
The pre-decrement form of the operator decrements x to 2 (x - 1 = 2) and returns the result as y:
var x:Number = 3; var y:Number = --x; //y is equal to 2
The post-decrement form of the operator decrements x to 2 (x - 1 = 2) and returns the original value of
var x:Number = 3; var y:Number = x--; //y is equal to 3
x as the result y:
25
The following example loops from 10 to 1, and each iteration of the loop decreases the counter variable
for (var i = 10; i>0; i--) {
}
i by 1.
trace(i);
26 Chapter 2: ActionScript Language Reference

++ (increment)

Availability
Flash Player 4.
Usage
++expression
expression++
Parameters
expression
Returns
A number.
Description
Operator (arithmetic); a pre-increment and post-increment unary operator that adds 1 to
expression. The expression can be a variable, element in an array, or property of an object.
The pre-increment form of the operator ( result. The post-increment form of the operator ( returns the initial value of
The pre-increment form of the operator increments as
y:
var x:Number = 1; var y:Number = ++x; trace("x:"+x);//traces x:2 trace("y:"+y);//traces y:2
The post-increment form of the operator increments x to 2 (x + 1 = 2) and returns the original value of
var x:Number = 1; var y:Number = x++; trace("x:"+x);//traces x:2 trace("y:"+y);//traces y:1
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
A number or a variable that evaluates to a number.
++expression) adds 1 to expression and returns the
expression++) adds 1 to expression and
expression (the value prior to the addition).
x to 2 (x + 1 = 2) and returns the result
x as the result y:
Example
The following example uses ++ as a post-increment operator to make a while loop run five times:
var i:Number = 0; while (i++<5) {
trace("this is execution "+i); } /* output:
this is execution 1
this is execution 2
this is execution 3
this is execution 4
++ (increment) 27
this is execution 5 */
The following example uses ++ as a pre-increment operator:
var a:Array = []; // var a:Array = new Array(); var i:Number = 0; while (i<10) {
a.push(++i); } trace(a.toString());//traces: 1,2,3,4,5,6,7,8,9,10
This example also uses ++ as a pre-increment operator.
var a:Array = []; for (var i = 1; i<=10; ++i) {
a.push(i); } trace(a.toString());//traces: 1,2,3,4,5,6,7,8,9,10
This script shows the following result in the Output panel:
1,2,3,4,5,6,7,8,9,10
The following example uses ++ as a post-increment operator in a while loop:
// using a while loop var a:Array = []; // var a:Array = new Array(); var i:Number = 0; while (i<10) {
a.push(i++); } trace(a.toString());//traces 0,1,2,3,4,5,6,7,8,9
The following example uses ++ as a post-increment operator in a for loop:
// using a for loop var a:Array = []; // var a:Array = new Array(); for (var i = 0; i<10; i++) {
a.push(i); } trace(a.toString());//traces 0,1,2,3,4,5,6,7,8,9
This script displays the following result in the Output panel:
0,1,2,3,4,5,6,7,8,9
28 Chapter 2: ActionScript Language Reference

! (logical NOT)

Availability
Flash Player 4.
Usage
!expression
Parameters
expression
Returns
A Boolean value.
Description
Operator (logical); inverts the Boolean value of a variable or expression. If expression is a variable with the absolute or converted value expression
The following expressions illustrate the result of using the logical NOT (!) operator:
!true returns false
!false
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
In the following example, the variable happy is set to false. The if condition evaluates the condition Output panel.
var happy:Boolean = false; if (!happy) {
trace("don’t worry, be happy");//traces don’t worry, be happy }
The statement traces because !false equals true.
An expression or a variable that evaluates to a Boolean value.
true, the value of !expression is false. If the
x && y evaluates to false, the expression !(x && y) evaluates to true.
returns true
!happy, and if the condition is true, the trace() statement sends a string to the
See also
!= (inequality), !== (strict inequality), && (logical AND), || (logical OR), == (equality), === (strict equality)
! (logical NOT) 29

!= (inequality)

Availability
Flash Player 5.
Usage
expression1 != expression2
Parameters
None.
Returns
A Boolean value.
Description
Operator (inequality); tests for the exact opposite of the equality (==) operator. If expression1 is equal to
expression2, the result is false. As with the equality (==) operator, the definition of
equal depends on the data types being compared, as illustrated in the following list:
Numbers, strings, and Boolean values are compared by value.
Objects, arrays, and functions are compared by reference.
A variable is compared by value or by reference, depending on its type.
Comparison by value means what most people would expect equals to mean—that two expressions have the same value. For example, the expression (2 + 3) is equal to the expression (1 + 4) when compared by value.
Comparison by reference means that two expressions are equal only if they both refer to the same object, array, or function. Values inside the object, array, or function are not compared.
When comparing by value, if ActionScript will attempt to convert the data type of
expression1. For more information, see “Automatic data typing” and “Operator precedence and
expression1 and expression2 are different data types,
expression2 to match that of
associativity” in Using ActionScript in Flash.
Example
The following example illustrates the result of the inequality (!=) operator:
trace(5 != 8);// returns true trace(5 != 5) //returns false
The following example illustrates the use of the inequality (!=) operator in an if statement:
var a:String = "David"; var b:String = "Fool"; if (a != b) {
trace("David is not a fool"); }
The following example illustrates comparison by reference with two functions:
var a:Function = function() {
30 Chapter 2: ActionScript Language Reference
trace("foo"); }; var b:Function = function() { trace("foo"); }; a(); // foo b(); // foo trace(a!=b); // true a = b; a(); // foo b(); // foo trace(a!=b); // false
// trace statement output: foo foo true foo foo false
The following example illustrates comparison by reference with two arrays:
var a:Array = [ 1, 2, 3 ]; var b:Array = [ 1, 2, 3 ]; trace(a); // 1, 2, 3 trace(b); // 1, 2, 3 trace(a!=b); // true a = b; trace(a); // 1, 2, 3 trace(b); // 1, 2, 3 trace(a!=b); // false
// trace statement output: 1,2,3 1,2,3 true 1,2,3 1,2,3 false
See also
! (logical NOT), !== (strict inequality), && (logical AND), || (logical OR), == (equality), === (strict equality)
!= (inequality) 31

!== (strict inequality)

Availability
Flash Player 6.
Usage
expression1 !== expression2
Parameters
None.
Returns
A Boolean value.
Description
Operator; tests for the exact opposite of the strict equality (===) operator. The strict inequality operator performs the same as the inequality operator except that data types are not converted. For more information, see “Automatic data typing” in Using ActionScript in Flash. If is equal to equality (
expression2, and their data types are equal, the result is false. As with the strict
===) operator, the definition of equal depends on the data types being compared, as
expression1
illustrated in the following list:
Numbers, strings, and Boolean values are compared by value.
Objects, arrays, and functions are compared by reference.
A variable is compared by value or by reference, depending on its type.
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The comments in the following code show the returned value of operations that use the equality (
==), strict equality (===), and strict inequality (!==) operators:
var s1:String = "5"; var s2:String = "5"; var s3:String = "Hello"; var n:Number = 5; var b:Boolean = true;
trace(s1 == s2); // true trace(s1 == s3); // false trace(s1 == n); // true trace(s1 == b); // false
trace(s1 === s2); // true trace(s1 === s3); // false trace(s1 === n); // false trace(s1 === b); // false
trace(s1 !== s2); // false trace(s1 !== s3); // true
32 Chapter 2: ActionScript Language Reference
trace(s1 !== n); // true trace(s1 !== b); // true
See also
! (logical NOT), != (inequality), && (logical AND), || (logical OR), == (equality), === (strict equality)
!== (strict inequality) 33

% (modulo)

Availability
Flash Player 4. In Flash 4 files, the % operator is expanded in the SWF file as x - int(x/y) * y and may not be as fast or as accurate in later versions of Flash Player.
Usage
expression1 % expression2
Parameters
None.
Returns
A number.
Description
Operator (arithmetic); calculates the remainder of expression1 divided by expression2. If either of the convert them to numbers. The value. For more information, see “Automatic data typing” and “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following numeric example uses the modulo (%) operator:
trace(12%5); // traces 2 trace(4.3%2.1); // traces 0.0999999999999996 trace(4%4); // traces 0
The first trace returns 2, rather than 12/5 or 2.4, because the modulo (%) operator returns only the remainder. The second trace returns 0.0999999999999996 instead of the expected 0.1 because of the limitations of floating-point accuracy in binary computing.
expression parameters are non-numeric, the modulo (%) operator attempts to
expression can be a number or string that converts to a numeric
See Also
int, / (division).
34 Chapter 2: ActionScript Language Reference

%= (modulo assignment)

Availability
Flash Player 4.
Usage
expression1 %= expression2
Parameters
None.
Returns
A number.
Description
Operator (arithmetic compound assignment); assigns expression1 the value of expression1 %
expression2
x %= y x = x % y
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following example assigns the value 4 to the variable x:
var x:Number = 14; var y:Number = 5; trace(x%=y); // output: 4
. The following two expressions are equivalent:
See also
% (modulo)
%= (modulo assignment) 35

& (bitwise AND)

Availability
Flash Player 5. In Flash 4, the AND (&) operator was used for concatenating strings. In Flash 5 and later, the AND (&) operator is a bitwise AND, and you must use the addition ( concatenate strings. Flash 4 files that use the AND (
&) operator are automatically updated to use
addition (+) operator when imported into the Flash 5 or later authoring environment.
Usage
expression1 & expression2
Parameters
None.
Returns
A 32-bit integer.
Description
Operator (bitwise); converts expression1 and expression2 to 32-bit unsigned integers, and performs a Boolean AND operation on each bit of the integer parameters. Floating-point numbers are converted to integers by discarding any digits after the decimal point. The result is a new 32-bit integer.
Positive integers are converted to an unsigned hex value with a maximum value of 4294967295 or 0xFFFFFFFF; values larger than the maximum have their most significant digits discarded when they are converted so the value is still 32-bit. Negative numbers are converted to an unsigned hex value using the two’s complement notation, with the minimum being -2147483648 or 0x800000000; numbers less than the minimum are converted to two’s complement with greater precision and then have the most significant digits discarded as well.
The return value is interpreted as a two’s complement number with sign, so the return is an integer in the range -2147483648 to 2147483647.
+) operator to
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following example compares the bit representation of the numbers and returns 1 only if both bits at the same position are 1. In this ActionScript, you add 13 (binary 1101) and 11 (binary
1011) and return 1 only in the position where both numbers have a 1.
var insert:Number = 13; var update:Number = 11; trace(insert & update);// output : 9 (or 1001 binary)
In the numbers 13 and 11 the result is 9 because only the first and last positions in both numbers have the number 1.
The following examples show the behavior of the return value conversion:
trace(0xFFFFFFFF); // 4294967295 trace(0xFFFFFFFF & 0xFFFFFFFF); // -1
36 Chapter 2: ActionScript Language Reference
trace(0xFFFFFFFF & -1); // -1 trace(4294967295 & -1); // -1 trace(4294967295 & 4294967295); // -1
See Also
&= (bitwise AND assignment), ^ (bitwise XOR), ^= (bitwise XOR assignment), | (bitwise OR), |= (bitwise OR assignment), ~ (bitwise NOT)
& (bitwise AND) 37

&& (logical AND)

Availability
Flash Player 4.
Usage
expression1 && expression2
Parameters
None.
Returns
A Boolean value.
Description
Operator (logical); performs a Boolean operation on the values of one or both of the expressions. Evaluates expression evaluates to on the right side of the operator) is evaluated. If
true; otherwise, it is false.
Expression Evaluates
true&&true
true&&false
false&&false
false&&true
expression1 (the expression on the left side of the operator) and returns false if the
false. If expression1 evaluates to true, expression2 (the expression
expression2 evaluates to true, the final result is
true
false
false
false
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following example uses the logical AND (&&) operator to perform a test to determine if a player has won the game. The
turns variable and the score variable are updated when a player
takes a turn or scores points during the game. The script shows “You Win the Game!” in the Output panel when the player’s score reaches 75 or higher in 3 turns or less.
var turns:Number = 2; var score:Number = 77; if ((turns<=3) && (score>=75)) {
trace("You Win the Game!"); } else {
trace("Try Again!"); } /* output:
You Win the Game! */
38 Chapter 2: ActionScript Language Reference
See also
! (logical NOT), != (inequality), !== (strict inequality), || (logical OR), == (equality), === (strict equality)
&& (logical AND) 39

&= (bitwise AND assignment)

Availability
Flash Player 5.
Usage
expression1 &= expression2
Parameters
None.
Returns
A 32-bit integer; the value of expression1 & expression2.
Description
Operator; assigns expression1 the value of expression1 & expression2. For example, the following two expressions are equivalent:
x &= y; x = x & y;
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following example assigns the value 9 to x:
var x:Number = 15; var y:Number = 9; trace(x &= y); // output: 9
See also
& (bitwise AND), ^ (bitwise XOR), ^= (bitwise XOR assignment), | (bitwise OR), |= (bitwise OR assignment), ~ (bitwise NOT)
40 Chapter 2: ActionScript Language Reference

() (parentheses)

Availability
Flash Player 4.
Usage
(expression1 [, expression2])
(expression1, expression2)
function(parameter1,..., parameterN)
Parameters
expression1, expression2
function The function to be performed on the contents of the parentheses.
parameter1...parameterN A series of parameters to execute before the results are passed as
parameters to the function outside the parentheses.
Returns
Nothing.
Description
Operator; performs a grouping operation on one or more parameters, performs sequential evaluation of expressions, or surrounds one or more parameters and passes them as parameters to a function outside the parentheses.
Usage 1: Controls the order in which the operators execute in the expression. Parentheses override the normal precedence order and cause the expressions within the parentheses to be evaluated first. When parentheses are nested, the contents of the innermost parentheses are evaluated before the contents of the outer ones.
Usage 2: Evaluates a series of expressions, separated by commas, in sequence, and returns the result of the final expression.
Usage 3: Surrounds one or more parameters and passes them as parameters to the function outside the parentheses.
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Numbers, strings, variables, or text.
Example
Usage 1: The following statements show the use of parentheses to control the order in which expressions are executed (the value of each expression appears in the Output panel):
trace((2+3)*(4+5));//displays 45 trace(2+(3*(4+5)));//// displays 29 trace(2+(3*4)+5);// displays 19
Usage 2: The following example evaluates the function foo(), and then the function bar(), and returns the result of the expression
var a:Number = 1; var b:Number = 2;
a + b:
() (parentheses) 41
function foo() {
a += b; } function bar() {
b *= 10; } trace((foo(), bar(), a+b)); // outputs 23
Usage 3: The following example shows the use of parentheses with functions:
var today:Date = new Date(); trace(today.getFullYear()); // traces current year function traceParameter(param):Void {
trace(param); } traceParameter(2*2);//traces 4
See also
with
42 Chapter 2: ActionScript Language Reference
– (minus)
Availability
Flash Player 4.
Usage
(Negation) -expression
(Subtraction) expression1 - expression2
Parameters
None.
Returns
An integer or floating-point number.
Description
Operator (arithmetic); used for negating or subtracting.
Usage 1: When used for negating, it reverses the sign of the numerical
expression.
Usage 2: When used for subtracting, it performs an arithmetic subtraction on two numerical expressions, subtracting
expression2 from expression1. When both expressions are integers,
the difference is an integer. When either or both expressions are floating-point numbers, the difference is a floating-point number.
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
Usage 1: The following statement reverses the sign of the expression 2 + 3:
trace(-(2+3));// output: -5
Usage 2: The following statement subtracts the integer 2 from the integer 5:
trace(5-2);// output: 3
The result, 3, is an integer.
Usage 3: The following statement subtracts the floating-point number 1.5 from the floating-point number 3.25:
trace(3.25-1.5);// output: 1.75
The result, 1.75, is a floating-point number.
– (minus) 43

* (multiplication)

Availability
Flash Player 4.
Usage
expression1 * expression2
Parameters
None.
Returns
An integer or floating-point number.
Description
Operator (arithmetic); multiplies two numerical expressions. If both expressions are integers, the product is an integer. If either or both expressions are floating-point numbers, the product is a floating-point number.
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
Usage 1: The following statement multiplies the integers 2 and 3:
trace(2*3); // output: 6
The result, 6, is an integer.
Usage 2: This statement multiplies the floating-point numbers 2.0 and 3.1416:
trace(2.0 * 3.1416); // output: 6.2832
The result, 6.2832, is a floating-point number.
44 Chapter 2: ActionScript Language Reference

*= (multiplication assignment)

Availability
Flash Player 4.
Usage
expression1 *= expression2
Parameters
None.
Returns
The value of expression1 * expression2. If an expression cannot be converted to a numeric value, it returns
Description
Operator (arithmetic compound assignment); assigns expression1 the value of expression1 *
expression2. For example, the following two expressions are equivalent:
x *= y x = x * y
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
Usage 1: The following example assigns the value 50 to the variable x:
var x:Number = 5; var y:Number = 10; trace(x *= y); // output: 50
Usage 2: The second and third lines of the following example calculate the expressions on the right side of the equal sign and assign the results to
var i:Number = 5; var x:Number = 4-6; var y:Number = i+2; trace(x *= y); // output: -14
NaN (not a number).
x and y:
See also
* (multiplication)
*= (multiplication assignment) 45

, (comma)

Availability
Flash Player 4.
Usage
(expression1, expression2 [, expressionN...])
Parameters
None.
Returns
The value of expression1, expression2, and so on.
Description
Operator; evaluates expression1, then expression2, and so on. This operator is primarily used with the
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following example uses the comma (,) operator in a for loop:
for (i = 0, j = 0; i < 3 && j < 3; i++, j+=2) {
} // Output: // i = 0, j = 0 // i = 1, j = 2
The following example uses the comma (,) operator without the parentheses () operator and illustrates that the comma operator returns only the value of the first expression without the parentheses () operator:
for loop statement and is often used with the parentheses () operator.
trace("i = " + i + ", j = " + j);
var v:Number = 0; v = 4, 5, 6; trace(v); // output: 4
The following example uses the comma (,) operator with the parentheses () operator and illustrates that the comma operator returns the value of the last expression when used with the parentheses () operator:
var v:Number = 0; v = (4, 5, 6); trace(v); // output: 6
The following example uses the comma (,) operator without the parentheses () operator and illustrates that the comma operator sequentially evaluates all of the expressions but returns the value of the first expression. The second expression,
z++, is evaluated and z is incremented by
one.
var v:Number = 0; var z:Number = 0;
46 Chapter 2: ActionScript Language Reference
v = v + 4 , z++, v + 6; trace(v); // output: 4 trace(z); // output: 1
The following example is identical to the previous example except for the addition of the parentheses () operator and illustrates once again that, when used with the parentheses () operator, the comma (,) operator returns the value of the last expression in the series:
var v:Number = 0; var z:Number = 0; v = (v + 4, z++, v + 6); trace(v); // output: 6 trace(z); // output: 1
See also
() (parentheses)
, (comma) 47

. (dot)

Availability
Flash Player 4.
Usage
object.property_or_method
instancename.variable
instancename.childinstance
instancename.childinstance.variable
Parameters
object
An instance of a class. The object can be an instance of any of the built-in ActionScript
classes or a custom class. This parameter is always to the left of the dot (.) operator.
property_or_method The name of a property or method associated with an object. All the
valid methods and properties for the built-in classes are listed in the method and property summary tables for that class. This parameter is always to the right of the dot (.) operator.
instancename The instance name of a movie clip.
childinstance A movie clip instance that is a child of, or nested in, another movie clip.
variable A variable on the Timeline of the movie clip instance name to the left of the dot
(
.) operator.
Returns
The method, property or movie clip named on the right side of the dot.
Description
Operator; used to navigate movie clip hierarchies to access nested (child) movie clips, variables, or properties. The dot operator is also used to test or set the properties of an object or top-level class, execute a method of an object or top-level class, or create a data structure.
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following example identifies the current value of the variable hairColor in the movie clip
person_mc:
person_mc.hairColor
The Flash 4 authoring environment did not support dot syntax, but Flash MX 2004 files published for Flash Player 4 can use the dot operator. The preceding example is equivalent to the following (deprecated) Flash 4 syntax:
/person_mc:hairColor
The following example creates a new movie clip within the _root scope. Then a text field is created inside the movie clip called
true and then populated with the current date.
48 Chapter 2: ActionScript Language Reference
container_mc. The text field’s autoSize property is set to
this.createEmptyMovieClip("container_mc", this.getNextHighestDepth()); this.container_mc.createTextField("date_txt", this.getNextHighestDepth(), 0,
0, 100, 22); this.container_mc.date_txt.autoSize = true; this.container_mc.date_txt.text = new Date();
The dot (.) operator is used when targeting instances within the SWF file and when you need to set properties and values for those instances.
. (dot) 49

: (type)

Availability
Flash Player 6.
Usage
[modifiers] var variableName:type
function functionName():type { ... }
function functionName(parameter1:type, ... , parameterN:type) [ :type ]{ ... }
Note: To use this operator, you must specify ActionScript 2.0 and Flash Player 6 or later in the Flash tab of your FLA file’s Publish Settings dialog box.
Parameters
variableName
type A native data type, class name that you have defined, or interface name.
functionName An identifier for a function.
parameter An identifier for a function parameter.
Description
Operator; used for strict data typing; this operator specifies the variable type, function return type, or function parameter type. When used in a variable declaration or assignment, this operator specifies the variable’s type; when used in a function declaration or definition, this operator specifies the function’s return type; when used with a function parameter in a function definition, this operator specifies the variable type expected for that parameter.
Types are a compile-time-only feature. All types are checked at compile time, and errors are generated when there is a mismatch. (For more information, see Appendix A, “Error Messages,” in Using ActionScript in Flash.) Mismatches can occur during assignment operations, function calls, and class member dereferencing using the dot ( use strict data typing (see “Strict data typing” in Using ActionScript in Flash).
Types that you can use include all native object types, classes and interfaces that you define, and Function and Void. The recognized native types are Boolean, Number, and String. All built-in classes are also supported as native types. For more information, see “About data types” in Using ActionScript in Flash.
For information about operator precedence, see “Operator precedence and associativity” in Using ActionScript in Flash.
An identifier for a variable.
.) operator. To avoid type mismatch errors,
Example
Usage 1: The following example declares a public variable named userName whose type is String and assigns an empty string to it:
var userName:String = "";
50 Chapter 2: ActionScript Language Reference
Usage 2: The following example shows how to specify a function’s parameter type by defining a function named
function randomInt(integer:Number):Number {
return Math.round(Math.random()*integer); } trace(randomInt(8));
randomInt() that takes a parameter named integer of type Number:
Usage 3: The following example defines a function named squareRoot() that takes a parameter named
val of the Number type and returns the square root of val, also a Number type:
function squareRoot(val:Number):Number {
return Math.sqrt(val); } trace(squareRoot(121));
See Also
var
, function.
: (type) 51

?: (conditional)

Availability
Flash Player 4.
Usage
expression1
Parameters
expression1
such as
expression2, expression3 Values of any type.
Returns
The value of expression2 or expression3.
Description
Operator; instructs Flash to evaluate expression1, and if the value of expression1 is true, it returns the value of
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following statement assigns the value of variable x to variable z because expression1 evaluates to
var x:Number = 5; var y:Number = 10; var z = (x < 6) ? x: y; trace (z); // returns 5
The following example shows a conditional statement written in shorthand:
var timecode:String = (new Date().getHours()<11) ? "AM" : "PM"; trace(timecode);
The same conditional statement could also be written in longhand, as shown in the following example:
if (new Date().getHours()<11) {
var timecode:String = "AM"; } else {
var timecode:String = "PM"; } trace(timecode);
? expression2 : expression3
An expression that evaluates to a Boolean value; usually a comparison expression,
x < 5.
expression2; otherwise it returns the value of expression3.
true:
52 Chapter 2: ActionScript Language Reference

/ (division)

Availability
Flash Player 4.
Usage
expression1 / expression2
Parameters
expression
Returns
A floating-point number.
Description
Operator (arithmetic); divides expression1 by expression2. The result of the division operation is a double-precision floating-point number.
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following statement divides the current width and height of the Stage, and then displays the result in the Output panel.
trace(Stage.width/2); trace(Stage.height/2);
For a default Stage width and height of 550 x 400, the output is 275 and 150.
A number or a variable that evaluates to a number.
See Also
% (modulo)
/ (division) 53

// (comment delimiter)

Availability
Flash 1.
Usage
// comment
Parameters
comment
Returns
Nothing.
Description
Comment; indicates the beginning of a script comment. Any characters that appear between the comment delimiter ( by the ActionScript interpreter.
For more information, see “Deprecated Flash 4 operators” in Using ActionScript in Flash.
Example
The following script uses comment delimiters to identify the first, third, fifth, and seventh lines as comments:
// record the X position of the ball movie clip var ballX:Number = ball_mc._x; // record the Y position of the ball movie clip var ballY:Number = ball_mc._y; // record the X position of the bat movie clip var batX:Number = bat_mc._x; // record the Y position of the ball movie clip var batY:Number = bat_mc._y;
Any characters.
//) and the end-of-line character are interpreted as a comment and ignored
See also
/* (comment delimiter)
54 Chapter 2: ActionScript Language Reference

/* (comment delimiter)

Availability
Flash Player 5.
Usage
/* comment */
/*
comment comment
*/
Parameters
comment
Returns
Nothing.
Description
Comment; indicates one or more lines of script comments. Any characters that appear between the opening comment tag ( and ignored by the ActionScript interpreter. Use the // (comment delimiter) to identify single-line comments. Use the /* comment delimiter to identify comments on multiple successive lines. Leaving off the closing tag ( error message. Attempting to nest comments also returns an error message. After an opening comment tag (/*) is used, the first closing comment tag ( the number of opening comment tags (/*) placed between them.
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Any characters.
/*) and the closing comment tag (*/), are interpreted as a comment
*/) when using this form of comment delimiter returns an
*/) will end the comment, regardless of
Example
The following script uses comment delimiters at the beginning of the script:
/* records the X and Y positions of the ball and bat movie clips */
var ballX:Number = ball_mc._x; var ballY:Number = ball_mc._y; var batX:Number = bat_mc._x; var batY:Number = bat_mc._y;
The following attempt to nest comments will result in an error message:
/* this is an attempt to nest comments. /* But the first closing tag will be paired with the first opening tag */ and this text will not be interpreted as a comment */
See also
// (comment delimiter)
/* (comment delimiter) 55

/= (division assignment)

Availability
Flash Player 4.
Usage
expression1 /= expression2
Parameters
expression1,expression2
Returns
A number.
Description
Operator (arithmetic compound assignment); assigns expression1 the value of expression1 /
expression2. For example, the following two statements are equivalent:
x /= y x = x / y
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following code illustrates using the division assignment (/=) operator with variables and numbers:
var x:Number = 10; var y:Number = 2; x /= y; trace(x); // output: 5
A number or a variable that evaluates to a number.
See Also
/ (division)
56 Chapter 2: ActionScript Language Reference

[] (array access)

Availability
Flash Player 4.
Usage
myArray = [a0, a1,...aN]
myArray[i] = value
myObject[propertyName]
Parameters
myArray
a0, a1,...aN Elements in an array; any native type or object instance, including nested arrays.
i An integer index greater than or equal to 0.
myObject The name of an object.
propertyName A string that names a property of the object.
Returns
Usage 1: A reference to an array.
Usage 2: A value from the array; either a native type or an object instance (including an Array instance).
Usage 3: A property from the object; either a native type or an object instance (including an Array instance).
The name of an array.
Description
Operator; initializes a new array or multidimensional array with the specified elements (a0, and so on), or accesses elements in an array. The array access operator lets you dynamically set and retrieve instance, variable, and object names. It also lets you access object properties.
Usage 1: An array is an object whose properties are called elements, which are each identified by a number called an index. When you create an array, you surround the elements with the array access ([]) operator (or brackets). An array can contain elements of various types. For example, the following array, called
employee, has three elements; the first is a number and the second two are
strings (inside quotation marks):
var employee:Array = [15, "Barbara", "Jay"];
You can nest brackets to simulate multidimensional arrays. You can nest arrays up to 256 levels deep. The following code creates an array called
ticTacToe with three elements; each element is
also an array with three elements:
var ticTacToe:Array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; // Select Debug > List Variables in test mode // to see a list of the array elements.
[] (array access) 57
Usage 2: Surround the index of each element with brackets ([]) to access it directly; you can add a new element to an array, or you can change or retrieve the value of an existing element. The first index in an array is always 0, as shown in the following example:
var my_array:Array = new Array(); my_array[0] = 15; my_array[1] = "Hello"; my_array[2] = true;
You can use brackets ([]) to add a fourth element, as shown in the following example:
my_array[3] = "George";
You can use brackets ([]) to access an element in a multidimensional array. The first set of brackets identifies the element in the original array, and the second set identifies the element in the nested array. The following lines of code send the number 6 to the Output panel.
var ticTacToe:Array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; trace(ticTacToe[1][2]);// output: 6
Usage 3: You can use the array access ([]) operator instead of the eval() function to dynamically set and retrieve values for movie clip names or any property of an object. The following line of code sends the number 6 to the Output panel.
name["mc" + i] = "left_corner";
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following example shows two ways to create a new empty Array object; the first line uses brackets ([]):
var my_array:Array = []; var my_array:Array = new Array();
The following example creates an array called employee_array and uses the trace() statement to send the elements to the Output panel. In the fourth line, an element in the array is changed, and the fifth line sends the newly modified array to the Output panel:
var employee_array = ["Barbara", "George", "Mary"]; trace(employee_array); // output: Barbara,George,Mary employee_array[2] = "Sam"; trace(employee_array); // output: Barbara,George,Sam
In the following example, the expression inside the brackets ("piece" + i) is evaluated and the result is used as the name of the variable to be retrieved from the example, the variable equal to 5, for example, the value of the variable
i must live on the same Timeline as the button. If the variable i is
piece5 in the my_mc movie clip is displayed in
my_mc movie clip. In this
the Output panel:
myBtn_btn.onRelease = function() {
x = my_mc["piece"+i]; trace(x);
};
58 Chapter 2: ActionScript Language Reference
In the following example, the expression inside the brackets is evaluated, and the result is used as the name of the variable to be retrieved from movie clip
name_mc["A" + i];
name_mc:
If you are familiar with the Flash 4 ActionScript slash syntax, you can use the eval() function to accomplish the same result:
eval("name_mc.A" & i);
You can use the following ActionScript to loop over all objects in the _root scope, which is useful for debugging:
for (i in _root) {
trace(i+": "+_root[i]); }
You can also use the array access ([]) operator on the left side of an assignment statement to dynamically set instance, variable, and object names:
employee_array[2] = "Sam";
See also
Array class, Object class
[] (array access) 59

^ (bitwise XOR)

Availability
Flash Player 5.
Usage
expression1 ^ expression2
Parameters
expression1,expression2
Returns
A 32-bit integer.
Description
Operator (bitwise); converts expression1 and expression2 to 32-bit unsigned integers, and returns a 1 in each bit position where the corresponding bits in but not both, are 1. Floating-point numbers are converted to integers by discarding any digits after the decimal point. The result is a new 32-bit integer.
Positive integers are converted to an unsigned hex value with a maximum value of 4294967295 or 0xFFFFFFFF; values larger than the maximum have their most significant digits discarded when they are converted so the value is still 32-bit. Negative numbers are converted to an unsigned hex value via the two’s complement notation, with the minimum being -2147483648 or 0x800000000; numbers less than the minimum are converted to two’s complement with greater precision and also have the most significant digits discarded.
The return value is interpreted as a two’s complement number with sign, so the return value will be an integer in the range -2147483648 to 2147483647.
A number.
expression1 or expression2,
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following example uses the bitwise XOR operator on the decimals 15 and 9, and assigns the result to the variable
// 15 decimal = 1111 binary // 9 decimal = 1001 binary var x:Number = 15 ^ 9; trace(x); // 1111 ^ 1001 = 0110 // returns 6 decimal (0110 binary)
See also
x:
& (bitwise AND), &= (bitwise AND assignment), ^= (bitwise XOR assignment), | (bitwise OR), |= (bitwise OR assignment), ~ (bitwise NOT)
60 Chapter 2: ActionScript Language Reference

^= (bitwise XOR assignment)

Availability
Flash Player 5.
Usage
expression1 ^= expression2
Parameters
expression1,expression2
Returns
A 32-bit integer. Specifically, the value of expression1 ^ expression2.
Description
Operator (bitwise compound assignment); assigns expression1 the value of expression1 ^
expression2. For example, the following two statements are equivalent:
x ^= y x = x ^ y
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following example shows a bitwise XOR assignment (^=) operation:
// 15 decimal = 1111 binary var x:Number = 15; // 9 decimal = 1001 binary var y:Number = 9; trace(x ^= y); // returns 6 decimal (0110 binary)
Integers and variables.
See also
& (bitwise AND), &= (bitwise AND assignment), ^ (bitwise XOR), | (bitwise OR), |= (bitwise OR assignment), ~ (bitwise NOT)
^= (bitwise XOR assignment) 61

{} (object initializer)

Availability
Flash Player 5.
Usage
object = {name1: value1, name2: value2,...nameN: valueN} {expression1; [...expressionN]}
Parameters
object
name1,2,...N The names of the properties.
value1,2,...N The corresponding values for each name property.
Returns
Usage 1: An Object object.
Usage 2: Nothing, except when a function has an explicit return type is specified in the function implementation.
Description
Operator; creates a new object and initializes it with the specified name and value property pairs. Using this operator is the same as using the using the assignment operator. The prototype of the newly created object is generically named the Object object.
The object to create.
return statement, in which case the
new Object syntax and populating the property pairs
This operator is also used to mark blocks of contiguous code associated with flow control statements (
for, while, if, else, switch) and functions.
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The first line of the following code creates an empty object using the object initializer ({}) operator; the second line creates a new object using a constructor function:
var object:Object = {}; var object:Object = new Object();
The following example creates an object account and initializes the properties name, address,
city, state, zip, and balance with accompanying values:
var account:Object = {name:"Macromedia, Inc.",
address:"600 Townsend Street",
city:"San Francisco",
state:"California",
zip:"94103",
balance:"1000"};
for (i in account) {
trace("account."+i+" = "+account[i]); }
62 Chapter 2: ActionScript Language Reference
The following example shows how array and object initializers can be nested within each other:
var person:Object = {name:"Gina Vechio",
children:["Ruby", "Chickie", "Puppa"]};
The following example uses the information in the previous example and produces the same result using constructor functions:
var person:Object = new Object(); person.name = "Gina Vechio"; person.children = new Array(); person.children[0] = "Ruby"; person.children[1] = "Chickie"; person.children[2] = "Puppa";
The previous ActionScript example can also be written in the following format:
var person:Object = new Object(); person.name = "Gina Vechio"; person.children = new Array("Ruby", "Chickie", "Puppa");
See also
[] (array access)
, new, Object class
{} (object initializer) 63

| (bitwise OR)

Availability
Flash Player 5.
Usage
expression1 | expression2
Parameters
expression1,expression2
Returns
A 32-bit integer.
Description
Operator (bitwise); converts expression1 and expression2 to 32-bit unsigned integers, and returns a 1 in each bit position where the corresponding bits of either
expression2 are 1. Floating-point numbers are converted to integers by discarding any digits
after the decimal point. The result is a new 32-bit integer.
Positive integers are converted to an unsigned hex value with a maximum value of 4294967295 or 0xFFFFFFFF; values larger than the maximum have their most significant digits discarded when they are converted so the value is still 32-bit. Negative numbers are converted to an unsigned hex value via the two’s complement notation, with the minimum being -2147483648 or 0x800000000; numbers less than the minimum are converted to two’s complement with greater precision and also have the most significant digits discarded.
The return value is interpreted as a two’s complement number with sign, so the return value will be an integer in the range -2147483648 to 2147483647.
A number.
expression1 or
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following is an example of a bitwise OR (|) operation:
// 15 decimal = 1111 binary var x:Number = 15; // 9 decimal = 1001 binary var y:Number = 9; // 1111 | 1001 = 1111 trace(x | y); // returns 15 decimal (1111 binary)
Don’t confuse the single | (bitwise OR) with || (logical OR).
See also
& (bitwise AND), &= (bitwise AND assignment), ^ (bitwise XOR), ^= (bitwise XOR assignment), |= (bitwise OR assignment), ~ (bitwise NOT)
64 Chapter 2: ActionScript Language Reference

|| (logical OR)

Availability
Flash Player 4.
Usage
expression1 || expression2
Parameters
expression1, expression2
value.
Returns
A Boolean value.
Description
Operator (logical); evaluates expression1 (the expression on the left side of the operator) and returns
true if the expression evaluates to true. If expression1 evaluates to false,
expression2 (the expression on the right side of the operator) is evaluated. If expression2
evaluates to
false, the final result is false; otherwise, it is true.
If you use a function call as
expression1 evaluates to true.
The result is
true if either or both expressions evaluate to true; the result is false only if both
expressions evaluate to if any operand evaluates to
A Boolean value or an expression that converts to a Boolean
expression2, the function will not be executed by that call if
false. You can use the logical OR operator with any number of operands;
true, the result is true.
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following example uses the logical OR (||) operator in an if statement. The second expression evaluates to
var x:Number = 10; var y:Number = 250; var start:Boolean = false; if ((x>25) || (y>200) || (start)) {
trace("the logical OR test passed"); // output: the logical OR test passed }
true, so the final result is true:
The message the logical OR test passed appears because one of the conditions in the if statement is true ( condition evaluates to
The following example demonstrates how using a function call as unexpected results. If the expression on the left of the operator evaluates to returned without evaluating the expression on the right (the function
function fx1():Boolean {
trace("fx1 called");
return true;
y>200). Although the other two expressions evaluate to false, as long as one
true, the if block executes.
expression2 can lead to
true, that result is
fx2() is not called).
|| (logical OR) 65
} function fx2():Boolean {
trace("fx2 called");
return true; } if (fx1() || fx2()) {
trace("IF statement entered"); } /* The following is sent to the Output panel:
fx1 called
IF statement entered */
See also
! (logical NOT), != (inequality), !== (strict inequality), && (logical AND), == (equality), === (strict equality)
66 Chapter 2: ActionScript Language Reference

|= (bitwise OR assignment)

Availability
Flash Player 5.
Usage
expression1 |= expression2
Parameters
expression1,expression2
Returns
An integer.
Description
Operator (bitwise compound assignment); assigns expression1 the value of expression1 |
expression2
x |= y; x = x | y;
. For example, the following two statements are equivalent:
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following example uses the bitwise OR assignment (|=) operator:
// 15 decimal = 1111 binary var x:Number = 15; // 9 decimal = 1001 binary var y:Number = 9; // 1111 |= 1001 = 1111 trace(x |= y); // returns 15 decimal (1111 binary)
A number or variable.
See also
& (bitwise AND), &= (bitwise AND assignment), ^ (bitwise XOR), ^= (bitwise XOR assignment), | (bitwise OR), |= (bitwise OR assignment), ~ (bitwise NOT)
|= (bitwise OR assignment) 67

~ (bitwise NOT)

Availability
Flash Player 5.
Usage
~ expression
Parameters
expression
Returns
A 32-bit integer.
Description
Operator (bitwise); also known as the one’s complement operator or the bitwise complement operator. Converts the complement. That is, every bit that is a 0 is set to 1 in the result, and every bit that is a 1 is set to 0 in the result. The result is a signed 32-bit integer.
For example, the hex value 0x7777 is represented as this binary number:
0111011101110111
The bitwise negation of that hex value, ~0x7777, is this binary number:
1000100010001000
In hexadecimal, this is 0x8888. Therefore, ~0x7777 is 0x8888.
A number.
expression to a 32-bit signed integer, and then applies a bitwise one’s
The most common use of bitwise operators is for representing flag bits (Boolean values packed into 1 bit each).
Floating-point numbers are converted to integers by discarding any digits after the decimal point. Positive integers are converted to an unsigned hex value with a maximum value of 4294967295 or 0xFFFFFFFF; values larger than the maximum have their most significant digits discarded when they are converted so the value is still 32-bit. Negative numbers are converted to an unsigned hex value via the two’s complement notation, with the minimum being -2147483648 or 0x800000000; numbers less than the minimum are converted to two’s complement with greater precision and also have the most significant digits discarded.
The return value is interpreted as a two’s complement number with sign, so the return value is an integer in the range -2147483648 to 2147483647.
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following example demonstrates a use of the bitwise NOT (-) operator with flag bits:
var ReadOnlyFlag:Number = 0x0001; // defines bit 0 as the read-only flag var flags:Number = 0; trace(flags);
68 Chapter 2: ActionScript Language Reference
/* To set the read-only flag in the flags variable, the following code uses the
bitwise OR: */ flags |= ReadOnlyFlag; trace(flags); /* To clear the read-only flag in the flags variable, first construct a mask by
using bitwise NOT on ReadOnlyFlag. In the mask, every bit is a 1 except for
the read-only flag. Then, use bitwise AND with the mask to clear the read-
only flag. The following code constructs the mask and performs the bitwise
AND: */ flags &= ~ReadOnlyFlag; trace(flags); /* output:
0
1
0 */
See also
& (bitwise AND), &= (bitwise AND assignment), ^ (bitwise XOR), ^= (bitwise XOR assignment), | (bitwise OR), |= (bitwise OR assignment)
~ (bitwise NOT) 69

+ (addition)

Availability
Flash Player 4; Flash Player 5.In Flash 5 and later, + is either a numeric operator or a string concatenator depending on the data type of the parameter. In Flash 4, operator. Flash 4 files that are brought into the Flash 5 or later authoring environment undergo a conversion process to maintain data type integrity. The following example illustrates the conversion of a Flash 4 file containing a numeric quality comparison:
Flash 4 file:
x + y
Converted Flash 5 or later file:
Number(x) + Number(y)
Usage
expression1 + expression2
Parameters
expression1,expression2
Returns
A number or string.
A string, integer, or floating-point number.
Description
Operator; adds numeric expressions or concatenates (combines) strings. If one expression is a string, all other expressions are converted to strings and concatenated.
+ is only a numeric
If both expressions are integers, the sum is an integer; if either or both expressions are floating­point numbers, the sum is a floating-point number.
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
Usage 1: The following example concatenates two strings and displays the result in the Output panel.
var name:String = "Cola"; var instrument:String = "Drums"; trace(name+" plays "+instrument); // output: Cola plays Drums
Usage 2: This statement adds the integers 2 and 3 and displays the resulting integer, 5, in the Output panel:
trace(2+3); // output: 5
This statement adds the floating-point numbers 2.5 and 3.25 and displays the resulting floating­point number, 5.75, in the Output panel
trace(2.5+3.25); // output: 5.75
70 Chapter 2: ActionScript Language Reference
Usage 3: Variables associated with dynamic and input text fields have the data type String. In the following example, the variable deposit amount, the script attempts to add
deposit is an input text field on the Stage. After a user enters a
deposit to oldBalance. However, because deposit
is a String data type, the script concatenates (combines to form one string) the variable values rather than summing them.
var oldBalance:Number = 1345.23; var currentBalance = deposit_txt.text + oldBalance; trace(currentBalance);
For example, if a user enters 475 in the deposit text field, the trace() statement sends the value
4751345.23 to the Output panel.
To correct this, use the
var oldBalance:Number = 1345.23; var currentBalance:Number = Number(deposit_txt.text) + oldBalance; trace(currentBalance);
Number() function to convert the string to a number, as in the following:
The following example shows how numeric sums to the right of a string expression are not calculated:
var a:String = 3 + 10 + "asdf"; trace(a); // 13asdf var b:String = "asdf" + 3 + 10; trace(b); // asdf310
+ (addition) 71

+= (addition assignment)

Availability
Flash Player 4.
Usage
expression1 += expression2
Parameters
expression1,expression2
Returns
A string or a number.
Description
Operator (arithmetic compound assignment); assigns expression1 the value of expression1 +
expression2
x += y; x = x + y;
. For example, the following two statements have the same result:
This operator also performs string concatenation. All the rules of the addition (+) operator apply to the addition assignment
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
Usage 1: This example uses the += operator with a string expression and sends “My name is Gilbert” to the Output panel.
var x1:String = "My name is "; x1 += "Gilbert"; trace(x1); // output: My name is Gilbert
Usage 2: The following example shows a numeric use of the addition assignment (+=) operator:
var x:Number = 5; var y:Number = 10; x += y; trace(x); // output: 15
A number or string.
(+=) operator.
See also
+ (addition)
72 Chapter 2: ActionScript Language Reference

< (less than)

Availability
Flash Player 4; Flash Player 5. In Flash 5 and later, the < (less than) operator is a comparison operator capable of handling various data types. In Flash 4, that are brought into the Flash 5 or later authoring environment undergo a conversion process to maintain data type integrity. The following illustrates the conversion of a Flash 4 file containing a numeric quality comparison.
Flash 4 file:
x < y
Converted Flash 5 or later file:
Number(x) < Number(y)
Usage
expression1 < expression2
Parameters
expression1,expression2
Returns
A number or string.
A Boolean value.
Description
Operator (comparison); compares two expressions and determines whether expression1 is less than
expression2; if so, the operator returns true. If expression1 is greater than or equal to
expression2, the operator returns false. String expressions are evaluated using alphabetical
order; all capital letters come before lowercase letters.
< is an numeric operator. Flash 4 files
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following examples show true and false returns for both numeric and string comparisons:
trace(3<10); // true trace(10<3); // false trace("Allen"<"Jack"); // true trace("Jack"<"Allen"); //false trace("11"<"3"); // true trace("11"<3); // false (numeric comparison) trace("C"<"abc"); // true trace("A"<"a"); // true
< (less than) 73

<< (bitwise left shift)

Availability
Flash Player 5.
Usage
expression1
Parameters
expression1
expression2 A number or expression that converts to an integer from 0 to 31.
Returns
A 32-bit integer.
Description
Operator (bitwise); converts expression1 and expression2 to 32-bit integers, and shifts all the bits in conversion of filled in with 0 and bits shifted off the left end are discarded. Shifting a value left by one position is the equivalent of multiplying it by 2.
Floating-point numbers are converted to integers by discarding any digits after the decimal point. Positive integers are converted to an unsigned hex value with a maximum value of 4294967295 or 0xFFFFFFFF; values larger than the maximum have their most significant digits discarded when they are converted so the value is still 32-bit. Negative numbers are converted to an unsigned hex value via the two’s complement notation, with the minimum being -2147483648 or 0x800000000; numbers less than the minimum are converted to two’s complement with greater precision and also have the most significant digits discarded.
The return value is interpreted as a two’s complement number with sign, so the return value will be an integer in the range -2147483648 to 2147483647.
<< expression2
A number or expression to be shifted left.
expression1 to the left by the number of places specified by the integer resulting from the
expression2. The bit positions that are emptied as a result of this operation are
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
In the following example, the integer 1 is shifted 10 bits to the left:
x = 1 << 10
The result of this operation is x = 1024. This is because 1 decimal equals 1 binary, 1 binary shifted left by 10 is 10000000000 binary, and 10000000000 binary is 1024 decimal.
In the following example, the integer 7 is shifted 8 bits to the left:
x = 7 << 8
The result of this operation is x = 1792. This is because 7 decimal equals 111 binary, 111 binary shifted left by 8 bits is 11100000000 binary, and 11100000000 binary is 1792 decimal.
74 Chapter 2: ActionScript Language Reference
If you trace the following example, you see that the bits have been pushed two spaces to the left:
// 2 binary == 0010 // 8 binary == 1000 trace(2 << 2); // output: 8
See also
>>= (bitwise right shift and assignment), >> (bitwise right shift), <<= (bitwise left shift and assignment), >>> (bitwise unsigned right shift), >>>= (bitwise unsigned right shift and assignment)
<< (bitwise left shift) 75

<<= (bitwise left shift and assignment)

Availability
Flash Player 5.
Usage
expression1 <<= expression2
Parameters
expression1
expression2 A number or expression that converts to an integer from 0 to 31.
Returns
A 32-bit integer.
Description
Operator (bitwise compound assignment); this operator performs a bitwise left shift (<<=) operation and stores the contents as a result in equivalent:
A <<= B A = (A << B)
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
In the following example, you use the bitwise left shift and assignment (<<=) operator to shift all bits one space to the left:
var x:Number = 4; // shift all bits one slot to the left. x <<= 1; trace(x); // output: 8 // 4 decimal = 0100 binary // 8 decimal = 1000 binary
A number or expression to be shifted left.
expression1. The following two expressions are
See also
<< (bitwise left shift), >>= (bitwise right shift and assignment), >> (bitwise right shift)
76 Chapter 2: ActionScript Language Reference

<= (less than or equal to)

Availability
Flash Player 4.
In Flash 5 or later, the less than or equal to ( handling various data types. In Flash 4, into the Flash 5 or later authoring environment undergo a conversion process to maintain data type integrity. The following illustrates the conversion of a Flash 4 file containing a numeric quality comparison.
Flash 4 file:
x <= y
Converted Flash 5 or later file:
Number(x) <= Number(y)
Usage
expression1 <= expression2
Parameters
expression1,expression2
Returns
A number or string.
A Boolean value.
Description
Operator (comparison); compares two expressions and determines whether expression1 is less than or equal to
expression2, the operator returns false. String expressions are evaluated using alphabetical
expression2; if it is, the operator returns true. If expression1 is greater than
order; all capital letters come before lowercase letters.
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
<=) operator is a comparison operator capable of
<= is a numeric operator. Flash 4 files that are brought
Example
The following examples show true and false results for both numeric and string comparisons:
trace(5<=10); // true trace(2<=2); // true trace(10<=3); // false trace("Allen"<="Jack"); // true trace("Jack"<="Allen"); // false trace("11"<="3"); // true trace("11"<=3); // false (numeric comparison) trace("C"<="abc"); // true trace("A"<=a); // true
<= (less than or equal to) 77

= (assignment)

Availability
Flash Player 4.
In Flash 5 or later, Flash 4,
= is a numeric equality operator. Flash 4 files that are brought into the Flash 5 or later
authoring environment undergo a conversion process to maintain data type integrity.
Flash 4 file:
x = y
Converted Flash 5 or later file:
Number(x) == Number(y)
Usage
expression1 = expression2
Parameters
expression1
expression2 A value of any type.
Returns
The assigned value, expression2.
Description
Operator; assigns the value of expression2 (the parameter on the right) to the variable, array element, or property in Assignment by value copies the actual value of Assignment by value is used when a variable is assigned a number or string literal. Assignment by reference stores a reference to commonly used with the a reference to that location in memory is assigned to a variable.
= is an assignment operator, and the == operator is used to evaluate equality. In
A variable, element of an array, or property of an object.
expression1. Assignment can be either by value or by reference.
expression2 and stores it in expression1.
expression2 in expression1. Assignment by reference is
new operator. Use of the new operator creates an object in memory and
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following example uses assignment by value to assign the value of 5 to the variable x.
var x:Number = 5;
The following example uses assignment by value to assign the value "hello" to the variable x:
var x:String;
x = "hello";
78 Chapter 2: ActionScript Language Reference
The following example uses assignment by reference to create the moonsOfJupiter variable, which contains a reference to a newly created Array object. Assignment by value is then used to copy the value
moonsOfJupiter:
var moonsOfJupiter:Array = new Array(); moonsOfJupiter[0] = "Callisto";
"Callisto" to the first element of the array referenced by the variable
The following example uses assignment by reference to create a new object, and assign a reference to that object to the variable
neptune. Assignment by value is then used to assign the value of
49528 to the size property of the myObject object:
var mercury:Object = new Object(); mercury.diameter = 3030; // in miles trace (mercury.diameter); // output: 3030
The following example builds upon the previous example by creating a variable named merkur (the German word for mercury) and assigning it the value of
mercury. This creates two variables
that reference the same object in memory, which means you can use either variable to access the object’s properties. We can then change the diameter property to use kilometers instead of miles:
var merkur:Object = mercury; merkur.diameter = 4878; // in kilometers trace (mercury.diameter); // output: 4878
See also
== (equality)
= (assignment) 79

-= (subtraction assignment)

Availability
Flash Player 4.
Usage
expression1 -= expression2
Parameters
expression1,expression2
Returns
A number.
Description
Operator (arithmetic compound assignment); assigns expression1 the value of expression1 -
expression2. For example, the following two statements are equivalent:
x -= y; x = x - y;
String expressions must be converted to numbers; otherwise, NaN (not a number) is returned.
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following example uses the subtraction assignment (-=) operator to subtract 10 from 5 and assign the result to the variable
var x:Number = 5; var y:Number = 10; x -= y; trace(x); // output: -5
The following example shows how strings are converted to numbers:
var x:String = "5"; var y:String = "10"; x -= y; trace(x); // output: -5
A number or expression that evaluates to a number.
x:
See also
– (minus)
80 Chapter 2: ActionScript Language Reference

== (equality)

Availability
Flash Player 5.
Usage
expression1 == expression2
Parameters
expression1,expression2
A number, string, Boolean value, variable, object, array,
or function.
Returns
A Boolean value.
Description
Operator (equality); tests two expressions for equality. The result is true if the expressions are equal.
The definition of equal depends on the data type of the parameter:
Numbers and Boolean values are compared by value and are considered equal if they have the
same value.
String expressions are equal if they have the same number of characters and the characters
are identical.
Variables representing objects, arrays, and functions are compared by reference. Two such
variables are equal if they refer to the same object, array, or function. Two separate arrays are never considered equal, even if they have the same number of elements.
When comparing by value, if ActionScript will attempt to convert the data type of
expression1. For more information, see “Automatic data typing” and “Operator precedence and
expression1 and expression2 are different data types,
expression2 to match that of
associativity” in Using ActionScript in Flash.
Example
The following example uses the equality (==) operator with an if statement:
var a:String = "David", b:String = "David"; if (a == b) {
trace("David is David");
}
The following examples show the results of operations that compare mixed types:
var x:Number = 5; var y:String = "5"; trace(x == y); // output: true var x:String = "5"; var y:String = "66"; trace(x == y); // output: false var x:String = "chris";
== (equality) 81
var y:String = "steve"; trace(x == y); // output: false
The following examples show comparison by reference. The first example compares two arrays with identical length and elements. The equality operator will return
false for these two arrays.
Although the arrays appear equal, comparison by reference requires that they both refer to the same array. The second example creates the as the variable
firstArray. The equality operator will return true for these two arrays because
thirdArray variable, which points to the same array
the two variables refer to the same array.
var firstArray:Array = new Array("one", "two", "three"); var secondArray:Array = new Array("one", "two", "three"); trace(firstArray == secondArray); // will output false
// Arrays are only considered equal // if the variables refer to the same array. var thirdArray:Array = firstArray; trace(firstArray == thirdArray); // will output true
See also
! (logical NOT), != (inequality), !== (strict inequality), && (logical AND), || (logical OR), === (strict equality)
82 Chapter 2: ActionScript Language Reference

=== (strict equality)

Availability
Flash Player 6.
Usage
expression1 === expression2
Returns
A Boolean value.
Description
Operator; tests two expressions for equality; the strict equality (===)operator performs in the same way as the equality (
==) operator, except that data types are not converted. (For more
information, see “Automatic data typing” in Using ActionScript in Flash.) The result is both expressions, including their data types, are equal.
The definition of equal depends on the data type of the parameter:
Numbers and Boolean values are compared by value and are considered equal if they have the
same value.
String expressions are equal if they have the same number of characters and the characters
are identical.
Variables representing objects, arrays, and functions are compared by reference. Two such
variables are equal if they refer to the same object, array, or function. Two separate arrays are never considered equal, even if they have the same number of elements.
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
true if
Example
The comments in the following code show the returned value of operations that use the equality and strict equality operators:
// Both return true because no conversion is done var string1:String = "5"; var string2:String = "5"; trace(string1 == string2); // true trace(string1 === string2); // true
// Automatic data typing in this example converts 5 to “5” var string1:String = "5"; var num:Number = 5; trace(string1 == num); // true trace(string1 === num); // false
// Automatic data typing in this example converts true to “1” var string1:String = "1"; var bool1:Boolean = true; trace(string1 == bool1); // true trace(string1 === bool1); // false
=== (strict equality) 83
// Automatic data typing in this example converts false to “0” var string1:String = "0"; var bool2:Boolean = false; trace(string1 == bool2); // true trace(string1 === bool2); // false
The following examples show how strict equality treats variables that are references differently than it treats variables that contain literal values. This is one reason to consistently use String literals and to avoid the use of the
// Create a string variable using a literal value var str:String = "asdf”;
// Create a variable that is a reference var stringRef:String = new String("asdf");
// The equality operator does not distinguish among literals, variables, // and references trace(stringRef == "asdf"); // true trace(stringRef == str); // true trace("asdf" == str); // true
// The strict equality operator considers variables that are references // distinct from literals and variables trace(stringRef === "asdf"); // false trace(stringRef === str); // false
See also
new operator with the String class.
! (logical NOT), != (inequality), !== (strict inequality), && (logical AND), || (logical OR), == (equality), === (strict equality)
84 Chapter 2: ActionScript Language Reference

> (greater than)

Availability
Flash Player 4.
In Flash 5 or later, the greater-than ( various data types. In Flash 4, 5 or later authoring environment undergo a conversion process to maintain data type integrity. The following illustrates the conversion of a Flash 4 file containing a numeric quality comparison.
Flash 4 file:
x > y
Converted Flash 5 or later file:
Number(x) > Number(y)
Usage
expression1 >expression2
Parameters
expression1,expression2
Returns
A Boolean value.
Description
Operator (comparison); compares two expressions and determines whether expression1 is greater than to
expression2, the operator returns false. String expressions are evaluated using alphabetical
expression2; if it is, the operator returns true. If expression1 is less than or equal
order; all capital letters come before lowercase letters.
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
>) operator is a comparison operator capable of handling
> is a numeric operator. Flash 4 files that are brought into the Flash
A number or string.
Example
In the following example, the greater than (>) operator is used to determine whether the value of the text field
if (score_txt.text>90) {
trace("Congratulations, you win!");
} else {
trace("sorry, try again");
}
score_txt is greater than 90:
> (greater than) 85

>= (greater than or equal to)

Availability
Flash Player 4.
In Flash 5 or later, the greater than or equal to ( handling various data types. In Flash 4,
>= is a numeric operator. Flash 4 files that are brought
into the Flash 5 or later authoring environment undergo a conversion process to maintain data type integrity. The following illustrates the conversion of a Flash 4 file containing a numeric quality comparison.
Flash 4 file:
x > y
Converted Flash 5 or later file:
Number(x) > Number(y)
Usage
expression1 >= expression2
Parameters
expression1, expression2
Returns
A string, integer, or floating-point number.
A Boolean value.
Description
Operator (comparison); compares two expressions and determines whether expression1 is greater than or equal to
expression2 (true) or expression1 is less than expression2 (false).
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
>=) operator is a comparison operator capable of
Example
In the following example, the greater than or equal to (>=) operator is used to determine whether the current hour is greater than or equal to 12:
if (new Date().getHours()>=12) {
trace("good afternoon");
} else {
trace("good morning");
}
86 Chapter 2: ActionScript Language Reference

>> (bitwise right shift)

Availability
Flash Player 5.
Usage
expression1 >> expression2
Parameters
expression1
expression2 A number or expression that converts to an integer from 0 to 31.
Returns
A 32-bit integer.
Description
Operator (bitwise); converts expression1 and expression2 to 32-bit integers, and shifts all the bits in the conversion of the sign of the original bit (the bit farthest to the left) of bit is 1. Shifting a value right by one position is the equivalent of dividing by 2 and discarding the remainder.
Floating-point numbers are converted to integers by discarding any digits after the decimal point. Positive integers are converted to an unsigned hex value with a maximum value of 4294967295 or 0xFFFFFFFF; values larger than the maximum have their most significant digits discarded when they are converted so the value is still 32-bit. Negative numbers are converted to an unsigned hex value via the two’s complement notation, with the minimum being -2147483648 or 0x800000000; numbers less than the minimum are converted to two’s complement with greater precision and also have the most significant digits discarded.
A number or expression to be shifted right.
expression1 to the right by the number of places specified by the integer that results from
expression2. Bits that are shifted off the right end are discarded. To preserve
expression, the bits on the left are filled in with 0 if the most significant
expression1 is 0, and filled in with 1 if the most significant
The return value is interpreted as a two’s complement number with sign, so the return value will be an integer in the range -2147483648 to 2147483647.
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following example converts 65535 to a 32-bit integer and shifts it 8 bits to the right:
var x:Number = 65535 >> 8; trace(x); // outputs 255
The following example shows the result of the previous example:
var x:Number = 255
This is because 65535 decimal equals 1111111111111111 binary (sixteen 1’s), 1111111111111111 binary shifted right by 8 bits is 11111111 binary, and 11111111 binary is 255 decimal. The most significant bit is 0 because the integers are 32-bit, so the fill bit is 0.
>> (bitwise right shift) 87
The following example converts -1 to a 32-bit integer and shifts it 1 bit to the right:
var x:Number = -1 >> 1; trace(x); // outputs -1
The following example shows the result of the previous example:
var x:Number = -1
This is because -1 decimal equals 11111111111111111111111111111111 binary (thirty-two 1’s), shifting right by one bit causes the least significant (bit farthest to the right) to be discarded and the most significant bit to be filled in with 1. The result is 11111111111111111111111111111111 (thirty-two 1’s) binary, which represents the 32-bit integer -1.
See also
>>= (bitwise right shift and assignment)
88 Chapter 2: ActionScript Language Reference

>>= (bitwise right shift and assignment)

Availability
Flash Player 5.
Usage
expression1 >>= expression2
Parameters
expression1
expression2 A number or expression that converts to an integer from 0 to 31.
Returns
A 32-bit integer.
Description
Operator (bitwise compound assignment); this operator performs a bitwise right-shift operation and stores the contents as a result in
The following two expressions are equivalent:
A >>= B
A = (A >> B)
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following commented code uses the bitwise right shift and assignment (>>=) operator.
function convertToBinary(numberToConvert:Number):String {
var result:String = ""; for (var i = 0; i<32; i++) {
// Extract least significant bit using bitwise AND var lsb:Number = numberToConvert & 1; // Add this bit to the result string result = (lsb ? "1" : "0")+result; // Shift numberToConvert right by one bit, to see next bit
numberToConvert >>= 1; } return result;
} trace(convertToBinary(479)); // Returns the string 00000000000000000000000111011111 // This string is the binary representation of the decimal // number 479
A number or expression to be shifted right.
expression1.
See also
>> (bitwise right shift)
>>= (bitwise right shift and assignment) 89

>>> (bitwise unsigned right shift)

Availability
Flash Player 5.
Usage
expression1 >>> expression2
Parameters
expression1
expression2 A number or expression that converts to an integer between 0 and 31.
Returns
A 32-bit unsigned integer.
Description
Operator (bitwise); the same as the bitwise right shift (>>) operator except that it does not preserve the sign of the original
Floating-point numbers are converted to integers by discarding any digits after the decimal point. Positive integers are converted to an unsigned hex value with a maximum value of 4294967295 or 0xFFFFFFFF; values larger than the maximum have their most significant digits discarded when they are converted so the value is still 32-bit. Negative numbers are converted to an unsigned hex value via the two’s complement notation, with the minimum being -2147483648 or 0x800000000; numbers less than the minimum are converted to two’s complement with greater precision and also have the most significant digits discarded.
A number or expression to be shifted right.
expression because the bits on the left are always filled with 0.
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
Example
The following example converts -1 to a 32-bit integer and shifts it 1 bit to the right:
var x:Number = -1 >>> 1; trace(x); // output: 2147483647
This is because -1 decimal is 11111111111111111111111111111111 binary (thirty-two 1’s), and when you shift right (unsigned) by 1 bit, the least significant (rightmost) bit is discarded, and the most significant (leftmost) bit is filled with a 0. The result is 01111111111111111111111111111111 binary, which represents the 32-bit integer
2147483647.
See also
>>= (bitwise right shift and assignment)
90 Chapter 2: ActionScript Language Reference

>>>= (bitwise unsigned right shift and assignment)

Availability
Flash Player 5.
Usage
expression1 >>>= expression2
Parameters
expression1
expression2 A number or expression that converts to an integer from 0 to 31.
Returns
A 32-bit integer.
Description
Operator (bitwise compound assignment); performs an unsigned bitwise right-shift operation and stores the contents as a result in
A >>>= B A = (A >>> B)
For more information, see “Operator precedence and associativity” in Using ActionScript in Flash.
See also
>>> (bitwise unsigned right shift), >>= (bitwise right shift and assignment)
A number or expression to be shifted left.
expression1. The following two expressions are equivalent:
>>>= (bitwise unsigned right shift and assignment) 91
CHAPTER 2
ActionScript Language Reference

Accessibility class

Availability
Flash Player 6.
Description
The Accessibility class manages communication with screen readers. Screen readers are a type of assistive technology for visually impaired users that provides an audio version of screen content. The methods of the Accessibility class are static—that is, you don’t have to create an instance of the class to use its methods.
To get and set accessible properties for a specific object, such as a button, movie clip, or text field, use the
_accProps property. To determine whether the player is running in an environment that
supports accessibility aids, use creating accessible content, see “Accessibility overview” in Using Flash.

Method summary for the Accessibility class

Method Description
Accessibility.isActive()
Accessibility.updateProperties()
System.capabilities.hasAccessibility. For information on
Indicates whether a screen reader program is active.
Updates the description of objects on the screen for screen readers.
92 Chapter 2: ActionScript Language Reference

Accessibility.isActive()

Availability
Flash Player 6.
Usage
Accessibility.isActive() : Boolean
Parameters
None.
Returns
A Boolean value: true if the Flash Player is communicating with an accessibility aid (usually a screen reader);
Description
Method; indicates whether an accessibility aid is currently active and the player is communicating with it. Use this method when you want your application to behave differently in the presence of a screen reader or other accessibility aid.
Note: If you call this method within one or two seconds of the first appearance of the Flash window in which your document is playing, you might get a return value of Microsoft Active Accessibility (MSAA) client. This is because of an asynchronous communication mechanism between Flash and MSAA clients. You can work around this limitation by ensuring a delay of one to two seconds after loading your document before calling this method.
Example
The following example checks whether an accessibility aid is currently active:
if (Accessibility.isActive()) {
trace ("An accessibility aid is currently active");
} else {
trace ("There is currently no active accessibility aid");
}
false otherwise.
false even if there is an active
See also
Accessibility.updateProperties(), _accProps, System.capabilities.hasAccessibility
Accessibility.isActive() 93

Accessibility.updateProperties()

Availability
Flash Player 6 (6.0.65).
Usage
Accessibility.updateProperties() : Void
Parameters
None.
Returns
Nothing.
Description
Method; causes all changes to _accProps (accessibility properties) objects to take effect. For information on setting accessibility properties, see
If you modify the accessibility properties for multiple objects, only one call to
Accessibility.updateProperties() is necessary; multiple calls can result in reduced
performance and unintelligible screen reader results.
Example
If you change an image and want to update its accessible description, you could use the following ActionScript code:
my_mc.gotoAndStop(2);
_accProps.
if (my_mc._accProps == undefined ) {
my_mc._accProps = new Object();
} my_mc._accProps.name = "Photo of Mount Rushmore"; Accessibility.updateProperties();
See also
Accessibility.isActive(), _accProps, System.capabilities.hasAccessibility
94 Chapter 2: ActionScript Language Reference
CHAPTER 2
ActionScript Language Reference

_accProps

Availability
Flash Player 6.65.
Usage
_accProps.propertyName instanceName._accProps.propertyName
Parameters
propertyName
instanceName The instance name assigned to an instance of a movie clip, button, dynamic text
field, or input text field. To refer to the document, omit
Description
Property; lets you control screen reader accessibility options for SWF files, movie clips, buttons, dynamic text fields, and input text fields at runtime. These properties override the corresponding settings available in the Accessibility panel during authoring. For changes to these properties to take effect, you must call Accessibility panel, see “The Flash Accessibility panel” in Using Flash.
To determine whether the player is running in an environment that supports accessibility aids, use
System.capabilities.hasAccessibility.
The following table lists the name and data type of each setting in the Accessibility panel, and the kinds of objects to which the property can be applied. The term inverse logic means that the property setting is the inverse of the corresponding setting in the Accessibility panel. For example, setting the deselecting the Make Movie Accessible or Make Object Accessible option.
An accessibility property name (see the following description for valid names).
_accProps object that represents the entire Flash
instanceName.
Accessibility.updateProperties(). For information on the
_accProps property, its equivalent
silent property to true is equivalent to
Property Data type Equivalent in Accessibility panel Applies to
silent
forceSimple
name
Boolean Make Movie Accessible/
Make Object Accessible
(inverse logic)
Boolean Make Child Objects Accessible
(inverse logic)
String Name Whole SWF files
Whole SWF files Movie clips Buttons Dynamic text Input text
Whole SWF files Movie clips
Movie clips Buttons Input text
_accProps 95
Property Data type Equivalent in Accessibility panel Applies to
description
shortcut
* For the Shortcut field, use names of the form Control+A. Adding a keyboard shortcut to the Accessibility panel
doesn’t create a keyboard shortcut; it merely advises screen readers of an existing shortcut. For information on assigning a keyboard shortcut to an accessible object, see Key.addListener().
String Description Whole SWF files
Movie clips Buttons Dynamic text Input text
String Shortcut* Movie clips
Buttons Input text
To specify settings that correspond to the Tab index setting in the Accessibility panel, use the
Button.tabIndex, MovieClip.tabIndex, or TextField.tabIndex property.
There is no way to specify an Auto Label setting at runtime.
To refer to the
instanceName parameter. The value of _accProps must be an object. This means that if no _accProps object already exists, you must create one, as shown in the following example, before
you can assign values to the properties of the
if ( _accProps == undefined ) {
_accProps = new Object();
} _accProps.name = "My SWF file";
_accProps object that represents the entire Flash document, omit the
_accProps object:
When _accProps is used without the instanceName parameter, changes made to _accProps properties apply to the whole SWF file. For example, the following code sets the Accessibility
name property for the whole SWF file to the string "Pet Store" and then calls Accessibility.updateProperties() to cause that change:
_accProps.name = "Pet Store"; Accessibility.updateProperties();
In contrast, the following code sets the name property for a movie clip with the instance name
price_mc to the string "Price":
price_mc._accProps.name = "Price"; Accessibility.updateProperties();
If you are specifying several accessibility properties, make as many changes as you can before calling
Accessibility.updateProperties(), instead of calling it after each
property statement, as shown in the following example:
_accProps.name = "Pet Store"; animal_mc._accProps.name = "Animal"; animal_mc._accProps.description = "Cat, dog, fish, etc."; price_mc._accProps.name = "Price"; price_mc._accProps.description = "Cost of a single item"; Accessibility.updateProperties();
96 Chapter 2: ActionScript Language Reference
If you don’t specify an accessibility property for a document or an object, any values set in the Accessibility panel are implemented.
After you specify an accessibility property, you can’t revert its value to a value set in the Accessibility panel. However, you can set the property to its default value ( values; empty strings for string values) by deleting the property from the
false for Boolean
_accProps object, as
shown in the following example:
my_mc._accProps.silent = true; // set a property // other code here delete my_mc._accProps.silent; // revert to default value
The value of _accProps must be an object. This means that if no _accProps object already exists, you must create one before you can assign clues to the properties of the
if (_accProps == undefined) {
_accProps = new Object();
}
_accProps.name = "My movie";
Example
_accProps object.
If you change an image and want to update its accessibility description, you can use the following ActionScript code:
my_mc.gotoAndStop(2);
if (my_mc._accProps == undefined ) {
my_mc._accProps = new Object();
} my_mc._accProps.name = "Photo of Mount Rushmore"; Accessibility.updateProperties();
See also
Accessibility.isActive() System.capabilities.hasAccessibility
, Accessibility.updateProperties(),
_accProps 97
CHAPTER 2
ActionScript Language Reference

arguments object

Availability
Flash Player 5; property added in Flash Player 6.
Description
The arguments object is an array that contains the values that were passed as parameters to any function. Each time a function is called in ActionScript, an arguments object is automatically created for that function. A local variable, arguments object.

Property summary for the arguments object

Property Description
arguments.callee
arguments.caller
arguments.length
A reference to the function being called.
A reference to the calling function.
The number of parameters passed to a function.
arguments, is also created and lets you refer to the
98 Chapter 2: ActionScript Language Reference

arguments.callee

Availability
Flash Player 5.
Usage
arguments.callee:Function
Description
Property; refers to the function that is currently being called.
Example
You can use the arguments.callee property to make an anonymous function that is recursive, as shown in the following example:
factorial = function (x:Number) {
if (x<=1) {
return 1; } else {
return x*arguments.callee(x-1); }
}; trace(factorial(3)); // output: 6
The following example is a named recursive function:
function factorial(x:Number):Number {
if (x<=1) {
return 1; } else {
return x*factorial(x-1); }
} trace(factorial(4)); // output: 24
arguments.callee 99

arguments.caller

Availability
Flash Player 6.
Usage
arguments.caller:Function
Description
Property; refers to the calling function. The value of this property is null if the current function was not called by another function.
Example
The following example defines two functions—a caller function, named function1, which calls a another function, named function2:
// define the caller function, named function1 var function1:Function = function () {
function2("hello from function1");
}
// define the callee function, named function2 var function2:Function = function (aString:String) {
if (arguments.caller == function1) {
trace("function2 was called by function1");
trace(aString); }
}
// call function1 function1();
/* Output: function2 was called by function1 hello from function1 */
100 Chapter 2: ActionScript Language Reference
Loading...