actionscript Getting started with actionscript

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Remarks

Actionscript formerly developed by Macromedia Inc., which now have been acquired by Adobe Systems Inc. is a powerful object-oriented programming language based on ECMAScript. Initially created with very limited set of navigation controls like play(), stop(), gotoAndPlay() etc., usually used for 2D vector based animation and required Actionscript Virtual Machine(AVM) like Flash Player for execution, have now evolved into a robost and flexible programming language ideal for rapid rich internet application development, capable of hardware accelerated rendering with Stage3D, targeting not only Flash Player, but also Adobe AIR based desktop and mobile platforms.

Versions

VersionRelease Date
Flash 4 actions1999-01-01
Actionscript 12000-09-01
Actionscript 22003-09-01
Actionscript 32006-06-27

Source: https://en.wikipedia.org/wiki/ActionScript

Hello World Example

ActionScript 2.0:

_root.createTextField("message", 0, 5, 5, 300, 50);
var tf:TextFormat = new TextFormat(); 
tf.color = 0xFF0000;
tf.size = 32;
tf.bold = true;
message.setTextFormat(tf);
message.text = "Hello World!"; 
 

First function creates a TextField named "message" in the depth 0 of the _root(MainTimeline) at coordinates (5,5) having dimensions 300x50, where unit is pixel.

Then we create an instance of TextFormat class and assign color, size and bold properties and apply it to the TextField using second function to make our TextField red with fontsize 32 pixels and bold.

Finally, we assign the text property of our newly created TextField to "Hello World!".

ActionScript 3.0:

import flash.text.TextField;
import flash.text.TextFormat;

var message:TextField = new TextField();
message.x = message.y = 5;
message.width = 300;
message.height = 50;

var tf:TextFormat = new TextFormat(); 
tf.color = 0xFF0000;
tf.size = 32;
tf.bold = true;

message.defaultTextFormat = tf;
message.text = "Hello World!";
MovieClip(root).addChild(message);
 

Both of the above examples should output something like this:

enter image description here

Installation or Setup

Detailed instructions on getting actionscript set up or installed.



Got any actionscript Question?