.
Make simple functions with AS3
In this Flash tutorial you will see how to build your own function with actionscript 3.0.
I know people are saying AS3 is more complicated then the pervious versions, but I bet when you get to understand the basics you will like it even more.
What we will be making here is a very simple function that is called when the movie clip starts, the only content is a movie clip with a smiley graphic.
First we will need to import our smiley, so go to file -> import -> import to stage and locate the smiley on your computer.
Now right click on the smiley and choose convert to movie clip as shown below.

Go to the properties panel and give the movie clip an instance name, I just named mine smile.

Now just click somewhere on the stage so you have nothing selected and hit F9 to get to the actionscript panel and type in the following code.
function place_smiley():void
{
smile.x = Math.random() * 100
smile.y = Math.random() * 100
}
place_smiley();
The first line is declaring the function, and naming it "place_smiley"
The next two lines is telling what our function will do, in this case it will place our smiley somewhere on the stage with a random x and y axis.
The last line is calling the function when the flash movie starts.
So now try to start your movie and test if its all working.
Dave says: 2008-03-20
Dave says: 2008-03-20
tamm says: 2008-02-29
Admin Bob says: 2008-02-27
Vince says: 2008-02-24
Vince says: 2008-02-24
Admin Bob says: 2008-02-20
Edda says: 2008-02-20
Marina says: 2008-02-02

