lets stop();

Here we will take a closer look at the beginning of actionscript, Flash's native scripting language. We will make a simple 5 page presentation.

1. Open Flash, and resize the stage according to your need.

2. Make 2 more layers.

3. Rename the layers from buttom to top as Gfx,Actions,Labels.The layers should be placed like this

Labels—————-

Actions—————

Gfx——————-

Though this is not necessary, but it encourages best practice.

4. Now insert a blank keyframe in actions layer in the first frame.

5. Select the keyframe and then open Actions Layer.

6. Type the following script in "Actions Pannel"

stop();

7.This will make our moovie to stop in this particular frame.
8.Now save the file as "main.fla".
9. Make 5 copies of the file and name them "one.fla","two.fla","three.fla","four.fla","five.fla". These are our page files. We will load our page files into our "main.fla".
10.Open "main.fla"
11. Create a blank movieclip in library and name it "holder_mc".
12.Select Gfx layer's first frame and insert one blank keyframe in it.Place the blank movieclip in the stage.So that we have a blank movieclip on stage.Name the movieclip as "holder_mc".
13. Now place the "holder_mc" at the (0,0) position of stage. This is necessary put our pages at right place.Later on we will see how it affects the presentation.
14.Now make one button in the library.Lets name it "myBtn_btn" in the library.
15. Make 5 instances of "myBtn_btn" in stage and name them "first_btn","second_btn","third_btn", "fourth_btn","fifth_btn".All these names are the names of buttons on stage.
16.Select the first frame of Action's layer.Open the Action pannel.It should have only the follwing script in it, ahich we have written preveously.

stop();

17.Now add the following lines in it

first_btn.onRelease =function():Void{
_root.holder_mc.loadMovie("one.swf");
}
second_btn.onRelease =function():Void{
_root.holder_mc.loadMovie("two.swf");
}
third_btn.onRelease =function():Void{
_root.holder_mc.loadMovie("three.swf");
}
fourth_btn.onRelease =function():Void{
_root.holder_mc.loadMovie("four.swf");
}
fifth_btn.onRelease =function():Void{
_root.holder_mc.loadMovie("five.swf");
}

18. So our total script in first frame would be

stop();
first_btn.onRelease =function():Void{
_root.holder_mc.loadMovie("one.swf");
}
second_btn.onRelease =function():Void{
_root.holder_mc.loadMovie("two.swf");
}
third_btn.onRelease =function():Void{
_root.holder_mc.loadMovie("three.swf");
}
fourth_btn.onRelease =function():Void{
_root.holder_mc.loadMovie("four.swf");
}
fifth_btn.onRelease =function():Void{
_root.holder_mc.loadMovie("five.swf");
}

19.Now open all your five fla files and publish them to create five swfs.
20.Open "main.fla" and publish it to create "main.swf".
21. Thats it, you just open your main.swf by double cliking in it in window's explorer.Click on any of the 5 buttons.They will load on your main.swf.
22. So we get a 5 page working presentation.

I know, I have not explained each and everything here.But to know something, we must know something. So after creating this short presentation, we will start exploring more and try to understand how it works.

I would be happy to here from you.Please feel free to ask.

Happy flashing 😉

Advertisements

Author: saumya

designer / developer / maker / educator @saumya

4 thoughts on “lets stop();”

  1. Well, I have not stated what is “_root”. I got to explain it, as I know for a newbe this is alien.

    _root : Its the main tiime line of flash. LOL, whats that? Ok, when we open up flash and start a new file, the first thing in the interface is a time line.To target to this time line we use “_root”. This is called the “_root time line”. Any flash file has got a “_root” and that is the first time line, which holds all othere datas in our swf file.

    As we go forward and start learning more about scripting then we discuss more about it. For the time being lets go by this rule, that “_root” is a holder of all our contents in a swf file.

    targeting : This simply means to addressing. As we say somebody’s address by specifying his/her house no, followed by roadNo, followed by city etc, we specify our swfs the same way by specifying its address. Its called “targetting” in Flash.

  2. Hi Saumya,
    The script you have given for loading external .swf files in one file is nice and simple to understand.
    Can you please explain why the word “Void” is used while writting function.

  3. hi.Let me try to make you understand.
    “Void” here is the return type of the function. Because this function does not give us any value, the return type is “Void”.If this function might have returned a number, then we would have written “Number”. To understan return type of a function, I strongly suggest to read “Function”. If you got to know what a function is and how it works, then its very easy to understand what the return type is.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s