Space Explorer v.1 - Space Car Running

This section provides a tutorial example on how to use ActionScript 3 statement blocks in SWFC script file to build my Space Explorer - Version 1: the space car is running!

Let's try to build a simple Flash animation with the use of ActionScript 3.0 statement blocks in a SWFC script file:

Here is Space Explorer Version 1,

#- Copyright (c) 2014 by Dr. Herong Yang,
.flash bbox=400x400 background=#000044 fps=12
.circle space_car r=6 line=8 color=#cccccc fill=#ff0000

.frame 1
   .put space_car
      _root.x_pos = 6;
      _root.y_pos = 6;
      _root.x_speed = 1.0;
      _root.y_speed = 0.5;
      _x = _root.x_pos;
      _y = _root.y_pos;

.frame 2
      _root.x_pos += _root.x_speed;
      _root.y_pos += _root.y_speed;
      _x = _root.x_pos;
      _y = _root.y_pos;
.frame 3
      gotoFrame(1); // index=0 is for frame 1


Note that the argument value of function gotoFrame(n) is zero based. gotoFrame(1) is equivalent to "Go to frame 2".

Compile and generate the HTML code:

   -o space_explorer_1.swf

C:\herong>\local\SWFTools\swfdump.exe -E space_explorer_1.swf
   > space_explorer_1.html

Open space_explorer_1.html in a Web browser. You will see that my space car is running correctly with a constant speed!

If you are reading the Web version of this book, you will see the Flash running here. Otherwise, you will see a static image.

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 Structure and Tags

 SWF File Processing Rules

 SWF Files for Video and Audio Streams

 Outdated Tutorials


 Full Version in PDF/EPUB