Step 1: open Flash8, create a new project, save the name: HELLOWORLD.FLP, then in your directory has: HELLOWORLD.FLP,HELLOWORLD.FLP for Flash project files.
Step 2: Create a new flash ActionScript file, later we call ActionScript as the file, save the name: Helloworld.as. You can save as a file at Flash8! OK, write the following code in your file:
/*
Original: http://www.oiasoft.com/
Author: Korpton korpton@163.com
Date: 2006/10/13
*/
Class helloworld{
Public Function SayHello (fword:string): string{
var hello:string = "Hello," + Fword;
return hello;
}
}
Save.
Step 3: Create a new Flash file, save the name: Helloworld.fla file, open the menu: Window-> components, find the User Interface inside the Label component, drag into the scene. Select the component that you just dragged in, and in the Properties panel, enter the name of the label instance just now: Hello_lab.
Step 4: write the following code on your timeline:
/*
Original: http://www.oiasoft.com/
Author: Korpton korpton@163.com
Date: 2006/10/13
*/
var myhello:helloworld = new HelloWorld ();
Hello_lab.text = Myhello.sayhello ("World");
Step 5: Helloworld.flas and helloworld.as two files into the project! Open Project window, menu is: Window-> item shortcut key is: Shift+f8. In the Project window, select the debugger-> Add File-> joined the two files just now to complete the join project.
Step 6: Click on the test project, the button can be tested HelloWorld project. Note: The first test is directly selected Helloworld.fla file can be. Complete, over!
Summary: in this small project you can learn:
1. How to make use of a project.
2. OOP programming in Flash.
3. Use of label components.
4. Flash ActionScript Notes
Original: oiasoft.com! (Contact: korpton@163.com)