Sunday, December 19, 2010

Adobe flash CS5 -actionscript 3.0 -- HelloWorld


Download a free trial of Flash Professional CS5 is HERE
1) Open Flash Professional CS5
2) File ->New->ActionScript 3.0 Class, type class: MyHelloWorld, type following code

package {


public class MyHelloWorld {


public function MyHelloWorld() {
// constructor cod
public function sayHello():String {
var greeting:String = "Hello World!";
return greeting;


       }
  }
}
3) Save as MyHellowWorld.as
4) File->New->ActionScript 3.0, Click T in the right menu bar
draw a rectangle in the center, change <instance name> in T in the right panel
as hello_txt
4) push keyboard F9 outside of the rectangle box, type following code:

import HelloWorld;
var classInstance:HelloWorld = new HelloWorld();
hello_txt.text = classInstance.sayHello();

5) Save as MyHelloWorld.fla
6) Control->Test Movie->in Flash Professional or (Ctrl enter)
you can watch swf file
7) File->Export->Export Movie, save as MyHelloWorld.swf
8) My result:


No comments:

Post a Comment