Global functions are called without an object. Many began as Flash 4 actions and compile to single bytecode actions; those that act on a timeline act on the one the code is on, or on the one given as a target. The player column is the first Flash Player that has each function, as Macromedia’s references give it.
Timeline and playback
| Function | Does | Player |
|---|---|---|
play() | Starts the playhead. | 2 |
stop() | Stops it. | 2 |
gotoAndPlay([scene,] frame) | Goes to a frame and plays. | 2 |
gotoAndStop([scene,] frame) | Goes to a frame and stops. | 2 |
nextFrame(), prevFrame() | Step one frame. | 2 |
nextScene(), prevScene() | Go to frame 1 of the next or previous scene. | 2 |
stopAllSounds() | Stops every sound playing. | 3 |
Movie clips
| Function | Does | Player |
|---|---|---|
duplicateMovieClip(target, newName, depth) | Copies a clip. | 4 |
removeMovieClip(target) | Removes a clip made by script. | 4 |
startDrag(target, [lock, l, t, r, b]) | Starts dragging a clip. | 4 |
stopDrag() | Stops dragging. | 4 |
getProperty(target, property) | Reads a clip property such as _x. | 4 |
setProperty(target, property, value) | Sets one. | 4 |
targetPath(clip) | The clip’s path in dot syntax. Buttons, text fields and video from player 6. | 5 |
updateAfterEvent() | Redraws at once from a clip event or interval. | 5 |
Loading, URLs and the host
| Function | Does | Player |
|---|---|---|
getURL(url, [window, [method]]) | Opens a URL, in a browser window or frame, optionally sending the timeline’s variables by "GET" or "POST" (methods from player 4). | 2 |
loadMovie(url, target, [method]) | Loads a SWF file, or from player 6 a JPEG, into a clip. | 3 |
loadMovieNum(url, level, [method]) | Loads one into a level. | 4 |
unloadMovie(target), unloadMovieNum(level) | Remove a loaded movie. | 3 |
loadVariables(url, target, [method]) | Loads URL-encoded variables into a clip. The URL must be in the same superdomain as the movie. | 4 |
loadVariablesNum(url, level, [method]) | Loads them into a level. | 4 |
fscommand(command, args) | Sends a command to the program hosting the player: JavaScript in a browser page, or the standalone player’s own commands such as "fullscreen", "allowscale", "showmenu", "exec" and "quit". | 3 |
getVersion() | The player’s platform and version, such as "WIN 6,0,21,0". | 5 |
asfunction:name,arg | Not a function but a link protocol: a link in an HTML text field with this URL calls the function name with the string argument. | 5 |
Conversion, numbers and text
| Function | Does | Player |
|---|---|---|
Number(x) | Converts to a number. | 4 |
String(x) | Converts to a string. | 4 |
Boolean(x) | Converts to a boolean. | 5 |
Object(x) | Makes an empty object or wraps a value. | 5 |
Array(…) | Makes an array, as new Array(…). | 6 |
parseInt(s, [radix]), parseFloat(s) | Read a number from the start of a string. | 5 |
isNaN(x), isFinite(x) | Test for NaN and for a finite number. | 5 |
escape(s), unescape(s) | URL-encode and decode a string. | 5 |
getTimer() | Milliseconds since the movie started. | 4 |
eval(name) | The variable, property or clip with that name; see Variables. | 5 |
set(name, value) | Sets a variable by name. | 4 |
Timers and debugging
| Function | Does | Player |
|---|---|---|
setInterval(…), clearInterval(id) | Repeat a function call; see Events. | 6 |
trace(value) | Writes a value to the Output panel when testing in Flash. Publishing can leave the calls out. | 4 |
Printing
| Function | Does | Player |
|---|---|---|
print(target, bounds) | Prints a clip’s frames as vectors. bounds is "bmovie", "bmax" or "bframe". | 4 |
printAsBitmap(target, bounds) | Prints them as bitmaps, keeping transparency and colour effects. | 4 |
printNum(level, bounds), printAsBitmapNum(level, bounds) | The same for a level. | 5 |
Frames labelled #p are the ones printed; without them, every frame
is.
Deprecated Flash 4 functions
These still compile and run, but Flash 5 replaced them:
| Function | Did | Use instead | Player |
|---|---|---|---|
call(frame) | Runs another frame’s script without moving there | functions | 4 |
chr(code) | Character from a code | String.fromCharCode | 4 |
ord(char) | Code of a character | charCodeAt | 4 |
int(n) | Cuts off the fraction | Math.floor, Math.ceil | 4 |
length(s) | Length of a string | s.length | 4 |
substring(s, start, len) | Part of a string, counted from 1 | s.substr | 4 |
mbchr, mbord, mblength, mbsubstring | The same for multibyte text | String methods | 4 |
random(n) | A whole number from 0 to n − 1 | Math.random | 4 |
toggleHighQuality() | Switches anti-aliasing | _quality | 2 |
ifFrameLoaded, tellTarget | Statements; see Statements | _framesloaded, dot syntax | 4, 3 |
Global properties and constants
| Name | Is | Player |
|---|---|---|
_root, _parent, this | Timeline references; see Variables | 5 |
_levelN | The main timeline of level N | 4 |
_global | The global object | 6 |
_quality | Rendering quality: "LOW", "MEDIUM", "HIGH" or "BEST" | 5 |
_highquality | Deprecated: 0, 1 or 2 for the same | 4 |
_focusrect | Whether the yellow focus rectangle shows | 4 |
_soundbuftime | Seconds of streaming sound to buffer, 5 by default | 4 |
_accProps | Accessibility settings for screen readers | 6.0.65 |
maxscroll, scroll | Deprecated Flash 4 text field scrolling, written fieldVariable.scroll | 4 |
true, false, null, undefined, NaN, Infinity | Constants | 5 |
newline | A line break character for text | 4 |