ActionScript 1.0 & 2.0

 

With the release of Adobe Flash CS3 comes a new version of Flash's scripting language: ActionScript 3.0. The organizational structure of the scripts in the CS3 version has been totally re-vamped and will probably take some getting used to. However, as with any good update, Flash CS3 allows designers to work in the ActionScript 1.0 & 2.0 set-up. NOTE: The organization of the ActionScript 3.0 palette has been updated, but basic scripts are written in the same way. Some simple scripts for basic actions are below and designated by frame or button actions. 

STOP (frame)

stop();

STOP ALL SOUNDS (frame)

stopAllSounds();

STOP ALL SOUNDS (button)

on(release) {
stopAllSounds();
}

TIP: Inadvertently placing an actionscript on a frame instead of a button (or vice versa) is one of the most common mistakes made when beginning your Flash work. So if your movie is not functioning properly, check that your script is on the appropriate area. Flash's ActionScript dialogue box incorporates a "Check Syntax" option (circled in the screenshot below) that will display any errors on a separate window. The screenshot pictured below shows a button script that was mistakenly placed on a keyframe.

Flash ActionScript Check Syntax

GO TO AND PLAY A SPECIFIC FRAME NUMBER (button)

on(rollOver) {
gotoAndPlay(3);
}

GO TO AND PLAY A SPECIFIC FRAME LABEL (button)

on(rollOver) {
gotoAndPlay("start");
}

GO TO A WEB PAGE (button)

on(release) {
getURL("http://graduate.mica.edu/lab");
}

LOAD AN EXTERNAL SHOCKWAVE FILE (frame)

loadMovie(another_flash_movie.swf, 1);

NOTE: 1 in the above example designates the level that the new movie is loaded. The original or starting movie is automatically at level 0.