• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Actions

Actions

Action Syntax and Description Example(s)
break break; Tells the ActionScript to skip the rest of the loop.
x = 0;
while (true) {
  if (x >=100) {
    break;
  }
  ++x;
}

duplicateMovieClip duplicateMovieClip(target,newname,depth);

target: the path of the movie to duplicate

newname: the new name of the duplicated movie clip

depth: the level of the movie clip

Creates an instance of a movie clip when the movie is playing. If the parent movie clip is deleted, the duplicated movie clip is also deleted.
duplicateMovieClip ("_root.shark", "shark1", 1);
else else{statement(s)} Specifies the actions, clauses, arguments, or other conditionals required to run if the initial if statement returns false.
if (x == 2) {
  startDrag("myClip");
}else{
  stopDrag();
}

escape escape(expression); Converts the argument to a string and encodes it in a URL-encoded format, all alphanumeric characters are escaped with % hexadecimal sequences. For example, an opening (left) curly brace ({) would be escaped as %7B. escape ("Hello{[World]}");

Result:

("Hello%7B%5BWorld%5D%7D");
eval eval(expression); Accesses variables, properties, objects, or movie clips by name. this._x =eval(this._droptarget)._x;
for
for (int; condition; next) {
  statement;
}

int: the expression to evaluate before beginning the loop sequence.

condition: an expression that evaluates to true or false. The loop will execute the commands contained in it until the condition evaluates to false.

next: an expression to evaluate after each loop—usually, an assignment using ++ or --.

statement: the code that will execute when the condition evaluates to true.

The loop evaluates the int value once, then begins a looping sequence until the condition evaluates to false.
for (x = 0; x < 5; ++x) {
  trace ("Neptune Resorts");
}

The output window would show:
Neptune Resorts
Neptune Resorts
Neptune Resorts
Neptune Resorts
Neptune Resorts

function
function functionName (argument1, argument2){
  statement(s)
}

A set of defined statements that performs a certain task. You can define a function in one location and call it from a different movie. The arguments are optional.
function calcTax(price,tax){
  cost = price*tax + price
}

getURL getUrl(url [,window[,variables]]); Loads a document from a specific URL into a window or passes variables to another application at a defined URL. getURL("http://www.myurl.com","_blank")
gotoAndPlay gotoAndPlay (scene, frame); Sends the playhead to the specified frame in a scene and plays from that frame. The scene argument is optional. gotoAndPlay(1);
gotoAndStop gotoAndStop(scene, frame); Sends the playhead to the specified frame and stops at that frame. The scene argument is optional. gotoAndStop(1);
if
if (condition){
  statement;
}

Evaluates the condition given. If the condition is true, Flash runs the statements that follow.
if (done != true) {
  this.startDrag();
}

ifFrameLoaded
ifFrameLoaded(scene, frame) {
  statement;
}

Checks to see whether the contents of the specified frame have been loaded. If so, the statement is executed. The scene argument is optional.
ifFrameLoaded(this._totalframes) {
  gotoAndPlay (1);
}

#include #include "filename.as" Includes the contents of the file specified in the argument. #include "jigsaw.as"
loadMovie loadMovie (url [.location/target, [variables]]); Plays additional movies without closing Flash Player. Use target to specify a particular movie-clip timeline. loadMovie("movie.swf", _root.targetMC);
loadVariables loadVariables (url [.location/target, variables]]); Reads data from an external file and sets values for variables in a movie or movie clip. loadVariables("myvariables.txt", _root.variableTargetMC);
play play(); Move the playhead forward in the timeline.
if (x == 2) {
  play();
} else {
  gotoAndPlay (45);
}

removeMovieClip removeMovieClip(target);

target: the target path of the movie-clip instance created with duplicateMovieClip

Deletes a movie clip that was created with attachMovie or duplicateMovieClip.
removeMovieClip(_root.shark1);
return return (expression); Specifies the value returned by the function. The return action causes the function to stop executing.
function calcTax(price, tax){
  return(price, tax)
}

setProperty setProperty (target, property, expression);

target: the path to the instance name of the movie clip whose property is being set.

property: the property to be set

expression: the value to which the property is set

Changes the property of a movie clip as the movie plays.
setProperty ("shark1", _height, 400);
startDrag startDrag(target); Makes the movie clip specified in target draggable. The movie clip remains draggable until a stopDrag action is applied to it.
on (press) {
  startDrag("myClip");
}
on (release, releaseOutside) {
  stopDrag();
}

stopDrag stopDrag(target); Stops the movie clip specified in target from being draggable.
on (press) {
  startDrag("myClip");
}
on (release, releaseOutside) {
  stopDrag();
}

stop stop(); Stops the current timeline from playing.
if (x > 0 ) {
  stop();
}else {
  gotoAndStop(50);
}

stopAllSounds stopAllSounds(); Stops all sounds that are currently playing without stoppng the movie itself. Sounds set to stream will continue to stream as the playhead reaches the frame.
on (release, releaseOutside) {
  stopAllSounds();
}

trace trace (expression); Evaluates the expression and displays the result in the output window; similar to the alert function in JavaScript.
trace (x+=5);
trace ("Hi everyone!");

unloadMovie unloadMovie (location);

location: the depth level or target movie clip from which to unload the movie.

Removes movie that was loaded by the loadMovie command.
on (release) {
  unloadMovie (_level2);
}

updateAfterEvent updateAfterEvent(movie clip event);

movie clip event: allows you to specify one of the following events:

mouseMove. The action is executed any time the mouse is moved.

mouseDown. The action is executed when the left mouse button is clicked.

mouseUp. The action is executed when the mouse button is released.

keyDown. The action is executed when any key is pressed.

keyUp. The action is executed when a key is released.

Updates the display after the clip event specified in the arguments has completed.
updateAfterEvent(mouseMove);
while
while (condition) {
  statements;
}

Runs a series of statements in the loop as long as the loop conditions continue to be true.
while (x > 5) {
  trace(hammerhead);
  x++;
}



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint