Flash Tutorials - Herong's Tutorial Examples - Version 3.01, by Dr. Herong Yang
Using ActionScript in SWFC Scripts
This section describes how to use ActionScript 3.0 statement blocks inside a SWFC script file with '.action' commands.
SWFC script compiler from SWFTools also supports ActionScript 3.0. Here are some notes on how to use ActionScript 3.0 statement blocks inside a SWFC script file:
1. ActionScript 3.0 statement block should be coded with this syntax:
.action ActionScript statement ActionScript statement ... .end
2. The built-in object, "_root", represents the default MovieClip object, which is the drawing panel of all display objects. It can also be used to store user defined properties like this:
_root.speed = 7.29; _root.angle += 60*_root.speed;
3. Two built-in properties, "_x" and "_y", represents the top-left corner position of the default MovieClip object, "_root". "_x" and "_y" are like short-hand forms of "_root._x" and "_root._y". By default, "_x,_y" is located at "0,0" If "_x,_y" is changed, all display objects rendered on "_root" will be shifted. For example, the follow to statements will shift all display objects 50 pixel south east:
_x = _x + 50; _y = _y - 50;
4. If you want to jump to a specific frame and continue to play, you can use these two built-in functions:
gotoFrame(n); // n is the index of frames starting from 0 play();
Last update: 2014.
Table of Contents