Classic Case--hello World

Source: Internet
Author: User

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)



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.