Well, if you want to start some development in ActionScript then you might be troubled trying to find a "hello world" source code program to start familiarizing with the language (most examples and tutorials assume that you are using a IDE).
In this case do the following:
1.- Download and install FlexSDK.
2.- Modify PATHs in order to be able to execute the programs coming in flexsdk (e.g. the compiler mxmlc).
3.- Open a text file named "hello.as", paste and save the following:
package {
import flash.display.*;
import flash.text.*;
public class hello extends Sprite{
public function hello (){
var t:TextField = new TextField();
t.text = "Hello World";
t.width = 100;
t.height = 100;
t.x = 50;
t.y = 50;
addChild(t);
}
}
}
3.- Compile it: mxmlc hello.as (this will create hello.swf)
4.- Create an HTML file in your webserver with:
5.- VoilĂ ! your are seeing your first ActionScript program.
<html>
<body>
<object width="100" height="100">
<param name="movie" value="hello.swf">
<embed src="hello.swf" width="100" height="100">
</embed>
</object>
</body>
</html>
No comments:
Post a Comment