UnGames:Main Page/Editing Guideline/Flash Hello World

From Uncyclopedia, the content-free encyclopedia
Jump to navigation Jump to search

If you haven't touched programming, and haven't touched ActionScript, it's better for you to start from Adobe Flash Professional. In this tutorial, I will use Adobe Flash Professional CS5. I'm sorry that I have customized the interface, but it doesn't matter much.

Don't I have to teach you how to open new fla?

Flash startAS.jpg

Click Window->Actions, and there will be a text panel(probably not on bottoim). This text panel is for inserting ActionScript.

Let's start...

Insert:

trace("hello world");

Press Ctrl+Enter

Flash firstHelloWorld.jpg

Congratulation! You have made your first flash creation. However, you find out that this "hello world" doesn't appear on the flash player but the "Output" Panel. Yep! trace() is for testing only, in a real swf, it won't pop this out. But please don't look down on it. It's your friend when testing and debuging.

Okay! Now let's put this "hello world" into the flash.

To display "hello world", there are two ways. And I will teach you the hard way first, which only use coding.

import flash.text.TextField;
var myTextField:TextField = new TextField();
addChild( myTextField);
myTextField.text = "hello world";

Press Ctrl+Enter

Flash codedHelloWorld.jpg

You succeed. You make the first swf in your life which really displays something. Let's upload it to Uncyclopedia so that the admin can huff it.

Well! Let's do it in another way.

Flash testFieldDrag.jpg

If you want to control this TextField with code, you have to click it, open the properties panel and insert the name (eq: myTextField) in that <Instance Name> box. And then you can control it with code, for example:

myTextField.text = "hello world";