Flash Tutorials - Herong's Tutorial Examples - v3.03, by Dr. Herong Yang
smiley.as - First ActionScript 3 Example
This section provides a tutorial example on using AS3Compile to compile a simple ActionScript 3 example into a SWF Flash file.
Now let's use the example provided on the SWFTools Web site to learn how to use AS3Compile:
1. Create a text file called smiley.as with these ActionScript3 statements:
package { import flash.display.MovieClip public class Main extends MovieClip { function Main() { this.graphics.beginFill(0xcccc00) this.graphics.drawCircle(200,200,200) this.graphics.endFill() this.graphics.beginFill(0x000000) this.graphics.drawCircle(140,150,50) this.graphics.drawCircle(260,150,50) this.graphics.drawRoundRect(140,270,120,10,20) this.graphics.endFill() } } }
2. Compile smiley.as file into a SWF file, smiley.swf:
C:\herong>\local\SWFTools\as3compile -X 400 -Y 400 smiley.as
3. Generate a HTML file, smiley.html, to view the SWF file:
C:\herong>\local\SWFTools\swfdump -E smiley.swf > smiley.html
4. Open smiley.html in a Web browser. You will see:
Congratulations, you have successfully compiled an ActionScript 3 source code into a SWF application with AS3Compile!
Table of Contents
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
SWFTools - SWF File Manipulation Tools
SWFC Script to Generate Flash SWF Files
ActionScript Embedded in SWFC Script
►AS3Compile - ActionScript 3 Compiler
►smiley.as - First ActionScript 3 Example
MyMovieClip.as - Adding Graphics and Text
ShowSystem.as - Showing System Properties