Please Note: Follow all instructions carefully. Missing any of them will make the whole thing Fail!
Hello World!
Output of a hello world program
For those of you who don't know what hello world is - hello world is most basic program possible and it should be the first program a person should try when learning a new language. A hello world program is one that simply shows the two words hello world triggered by some action by the user.
Hello world in Action ScriptBefore we begin. You may want to download the source code at the end of the page if you have difficulty.
Let us create a hello world program in actionscript 2.0. See what you will be doing to the ➜➜ (click the blue button) ➜ Getting ready
|
|
Create a text Box
We will need to create a text box for the words "Hello world" to appear
|
Now lets get a button
In this tutorial we will not make our own button , instead we will use one from the built in libraries
Bring a button to stage
|
Lets Code!
Let us recall that we created 2 objects on the stage: One is the text box with instance name textbox1 and a button with instance name button1 . As i told before , the instance name is basically the name we will use in our code to make changes to our objects such as textbox and buttons.Lets add code to our button.Adding Code to the button
To run the code : Hit CTR+ENTER
- Select the button ( very important )
- hit F9 to see actions window.
- Then write following code
To run the code : Hit CTR+ENTER
on(release){ textbox1.text="hello world" }
Code explanation
There is nothing really to explain in this. When we click the button and release it the code gets executed. we refer to instance name textbox1, remember thats the name we gave to the textbox. Then we assign the words hello world to it. Yeah thats it.
NOTE: The words hello world should be in " " as it is a string.
Assignment:
There is nothing really to explain in this. When we click the button and release it the code gets executed. we refer to instance name textbox1, remember thats the name we gave to the textbox. Then we assign the words hello world to it. Yeah thats it.
NOTE: The words hello world should be in " " as it is a string.
Assignment:
- make a program with multiple buttons and multiple textboxes
- Experiment with the properties and filters(in properties)
- check out the various buttons
- play around flash for a while: the best way to learn!