Global Functions

This section contains a set of built-in functions that are available in any part of a SWF file where ActionScript is used. These global functions cover a wide variety of common programming tasks such as working with data types (Boolean(), int(), and so on), producing debugging information (trace()), and communicating with Flash Player or the browser (fscommand()).

Global Functions summary

Modifiers

Signature

Description

 

Array([numElements:Number], [elementN:Object]) : Array

Creates a new, empty array or converts specified elements to an array.

 

asfunction(function:String, parameter:String)

A special protocol for URLs in HTML text fields that allows an HREF link to call an ActionScript function.

 

Boolean(expression:Object) : Boolean

Converts the parameter expression to a Boolean value and returns true or false.

 

call(frame:Object)

Deprecated since Flash Player 5. This action was deprecated in favor of the function statement.

Executes the script in the called frame without moving the playhead to that frame.

 

chr(number:Number) : String

Deprecated since Flash Player 5. This function was deprecated in favor of String.fromCharCode().

Converts ASCII code numbers to characters.

 

clearInterval(intervalID:Number)

Stops the setInterval() call.

 

clearTimeout(id:Number)

Cancels a specified setTimeout() call.

 

duplicateMovieClip(target:Object, newname:String, depth:Number)

Creates an instance of a movie clip while the SWF file is playing.

 

escape(expression:String) : String

Converts the parameter to a string and encodes it in a URL-encoded format, where all nonalphanumeric characters are replaced with % hexadecimal sequences.

 

eval(expression:Object) : Object

Accesses variables, properties, objects, or movie clips by name.

 

fscommand(command:String, parameters:String)

Lets the SWF file communicate with either Flash Player or the program hosting Flash Player, such as a web browser.

 

getProperty(my_mc:Object, property) : Object

Returns the value of the specified property for the movie clip my_mc.

 

getTimer() : Number

Returns the number of milliseconds that have elapsed since the SWF file started playing.

 

getURL(url:String, [window:String], [method:String])

Loads a document from a specific URL into a window or passes variables to another application at a defined URL.

 

getVersion() : String

Returns a string containing Flash Player version and platform information.

 

gotoAndPlay([scene:String], frame:Object)

Sends the playhead to the specified frame in a scene and plays from that frame.

 

gotoAndStop([scene:String], frame:Object)

Sends the playhead to the specified frame in a scene and stops it.

 

ifFrameLoaded([scene:String], frame:Object)

Deprecated since Flash Player 5. This function has been deprecated. Adobe recommends that you use the MovieClip._framesloaded property.

Checks whether the contents of a specific frame are available locally.

 

int(value:Number) : Number

Deprecated since Flash Player 5. This function was deprecated in favor of Math.floor() for positive values and Math.ceil for negative values.

Converts a decimal number to an integer value by truncating the decimal value.

 

isFinite(expression:Object) : Boolean

Evaluates expression and returns true if it is a finite number or false if it is infinity or negative infinity.

 

isNaN(expression:Object) : Boolean

Evaluates the parameter and returns true if the value is NaN (not a number).

 

length(expression:String, variable:Object) : Number

Deprecated since Flash Player 5. This function, along with all the string functions, has been deprecated. Adobe recommends that you use the methods of the String class and the String.length property to perform the same operations.

Returns the length of the specified string or variable.

 

loadMovie(url:String, target:Object, [method:String])

Loads a SWF or JPEG file into Flash Player while the original SWF file plays.

 

loadMovieNum(url:String, level:Number, [method:String])

Loads a SWF or JPEG file into a level in Flash Player while the originally loaded SWF file plays.

 

loadVariables(url:String, target:Object, [method:String])

Reads data from an external file, such as a text file or text generated by ColdFusion, a CGI script, Active Server Pages (ASP), PHP, or Perl script, and sets the values for variables in a target movie clip.

 

loadVariablesNum(url:String, level:Number, [method:String])

Reads data from an external file, such as a text file or text generated by a ColdFusion, CGI script, ASP, PHP, or Perl script, and sets the values for variables in a Flash Player level.

 

mbchr(number:Number)

Deprecated since Flash Player 5. This function was deprecated in favor of the String.fromCharCode() method.

Converts an ASCII code number to a multibyte character.

 

mblength(string:String) : Number

Deprecated since Flash Player 5. This function was deprecated in favor of the methods and properties of the String class.

Returns the length of the multibyte character string.

 

mbord(character:String) : Number

Deprecated since Flash Player 5. This function was deprecated in favor of String.charCodeAt().

Converts the specified character to a multibyte number.

 

mbsubstring(value:String, index:Number, count:Number) : String

Deprecated since Flash Player 5. This function was deprecated in favor of String.substr().

Extracts a new multibyte character string from a multibyte character string.

 

MMExecute(command:String) : String

Lets you issue Flash JavaScript API (JSAPI) commands from ActionScript.

 

nextFrame()

Sends the playhead to the next frame.

 

nextScene()

Sends the playhead to Frame 1 of the next scene.

 

Number(expression:Object) : Number

Converts the parameter expression to a number.

 

Object([value:Object]) : Object

Creates a new empty object or converts the specified number, string, or Boolean value to an object.

 

on(mouseEvent:Object)

Specifies the mouse event or keypress that triggers an action.

 

onClipEvent(movieEvent:Object)

Triggers actions defined for a specific instance of a movie clip.

 

ord(character:String) : Number

Deprecated since Flash Player 5. This function was deprecated in favor of the methods and properties of the String class.

Converts characters to ASCII code numbers.

 

parseFloat(string:String) : Number

Converts a string to a floating-point number.

 

parseInt(expression:String, [radix:Number]) : Number

Converts a string to an integer.

 

play()

Moves the playhead forward in the Timeline.

 

prevFrame()

Sends the playhead to the previous frame.

 

prevScene()

Sends the playhead to Frame 1 of the previous scene.

 

print(target:Object, boundingBox:String)

Prints the target movie clip according to the boundaries specified in the parameter (bmovie, bmax, or bframe).

 

printAsBitmap(target:Object, boundingBox:String)

Prints the target movie clip as a bitmap according to the boundaries specified in the parameter (bmovie, bmax, or bframe).

 

printAsBitmapNum(level:Number, boundingBox:String)

Prints a level in Flash Player as a bitmap according to the boundaries specified in the parameter (bmovie, bmax, or bframe).

 

printNum(level:Number, boundingBox:String)

Prints the level in Flash Player according to the boundaries specified in the boundingBox parameter (bmovie, bmax, bframe).

 

random(value:Number) : Number

Deprecated since Flash Player 5. This function was deprecated in favor of Math.random().

Returns a random integer between 0 and one less than the integer specified in the <code><em>value</em></code>&#160;parameter.

 

removeMovieClip(target:Object)

Deletes the specified movie clip.

 

setInterval(functionReference:Function, interval:Number, [param:Object], objectReference:Object, methodName:String) : Number

Calls a function or a method of an object at periodic intervals while a SWF file plays.

 

setProperty(target:Object, property:Object, expression:Object)

Changes a property value of a movie clip as the movie clip plays.

 

setTimeout(functionReference:Object, delay:Number, args:Object) : Number

Runs a specified function after a specified delay (in milliseconds).

 

showRedrawRegions(enable:Boolean, [color:Number])

Provides the ability for the debugger player to outline the regions of the screen that are being redrawn.

 

startDrag(target:Object, [lock:Boolean], [left,top,right,bottom:Number])

Makes the target movie clip draggable while the movie plays.

 

stop()

Stops the SWF file that is currently playing.

 

stopAllSounds()

Stops all sounds currently playing in a SWF file without stopping the playhead.

 

stopDrag()

Stops the current drag operation.

 

String(expression:Object) : String

Returns a string representation of the specified parameter.

 

substring(string:String, index:Number, count:Number) : String

Deprecated since Flash Player 5. This function was deprecated in favor of String.substr().

Extracts part of a string.

 

targetPath(targetObject:Object) : String

Returns a string containing the target path of movieClipObject.

 

tellTarget(target:String, statement(s))

Deprecated since Flash Player 5. Adobe recommends that you use dot (.) notation and the with statement.

Applies the instructions specified in the statements parameter to the Timeline specified in the target parameter.

 

toggleHighQuality()

Deprecated since Flash Player 5. This function was deprecated in favor of _quality.

Turns anti-aliasing on and off in Flash Player.

 

trace(expression:Object)

Evaluates the expression and outputs the result.

 

unescape(string:String) : String

Evaluates the parameter x as a string, decodes the string from URL-encoded format (converting all hexadecimal sequences to ASCII characters), and returns the string.

 

unloadMovie(target:Object)

Removes a movie clip that was loaded by means of loadMovie() from Flash Player.

 

unloadMovieNum(level:Number)

Removes a SWF or image that was loaded by means of loadMovieNum() from Flash Player.

 

updateAfterEvent()

Updates the display when you call it within an handler or using setInterval().


Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00001166.html