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();

ActionScript 3.0 statement syntax is very similar to JavaScript. Read next chapters to learn more about ActionScript 3.0.

Last update: 2014.

Table of Contents

 About This Book

 Introduction of Adobe Flash

 Adobe Flash Player Plugin for Firefox

 Adobe Flash Player Plugin for Chrome

 Adobe Flash Player Plugin for Safari

 Adobe Flash Player ActiveX for IE

 Using "object" Elements for Flash Files

 Using "embed" Elements for Flash Files

 "mp3player" - MP3 Music Player

 SWFObject - Hidding "object" behind JavaScript

 Flash Player Projector

 SWFTools - SWF File Manipulation Tools

 SWFC Script to Generate Flash SWF Files

ActionScript Embedded in SWFC Script

Using ActionScript in SWFC Scripts

 Space Explorer v.1 - Space Car Running

 Space Explorer v.2 - Space Car Wondering

 Space Explorer v.3 - Space Car Bouncing

 Space Explorer v.4 - Space Car Stabilized

 AS3Compile - ActionScript 3 Compiler

 Adobe Flex SDK 4

 SWF File Struture and Tags

 SWF File Processing Rules

 SWF Files for Video and Audio Streams

 Outdated Tutorials

 References

 PDF Printing Version