Eloo Home about us
You are now at Eloo.VirtualReality.Flash Tutorials-


How to start this ActionScript Stuff?
-Make It Real!-

Basic of the Basic

Before you start writing ActionScript, it is necessary to know exactly how the entire Flash program operates the movie, because this is what a circumstance that the Flash program provides the ActionScriont to program a movie project.
To demonstrate the Flash Scripting environment

About the level/depth

What inside the Movie presenting that you don't see but actually exist is the "level", called "depth" in ActionScript syntax. However, you can still take a look at it by doing debug the Movie instead of test Movie(Control>Debug Movie, or press Ctrl+Shift+Enter).

Why are we here talking about the level? Because this "level(depth)" allows you to make your movie have more stages to perform(not just only front stage and back stage in real world), and this is also the way ActionScript manages all the instances(to give them address, housees, rooms to locate and call them afterward), either created virtually or by scripting.

By default, every time when you create a symbol from library and drag this symbol into the stage, the Flash creates an instance on the _level0. An instance is an object in ActionScript syntax. The level0 is also the "_root". The "_level0(_root)" is the initial level in a Movie, if you didn't define which level in the Movie you want to put your instance, they will all go to this "_level0(_root)". Also, because this is an initial level, it can hold more than one instance on it, you can't let them go underground, can you?(There has no basement in Flash though :P) , if you in any case want to create the instance in another level, you'll need to write ActionScript to define the depth of the instance you create. Be careful that except the _level0(_root), the rest of the levels can only be placed one instance, if you later accidentally create another instance and put it into the same level, the previous one will be remote(vanish in Movie forever). Luckily Flash allows us to have unlimited number of levels in a Movie, you can have as many as you want in your Movie.

About the Scene and level/depth

What happen to the levels when you create more than one scene and when the Movie navigates to another scene? The number of scenes will not effect the levels condition. It means if you have five scenes, it doesn't mean you'll have five levels. So? what happen to the levels? Is it bended? No. It sounds crazy but the truth is that the number of levels still remains the same. However the Timeline on each level gets extended.

This is a funny experiment that will let you understand what's going on about the levels and all instances behind the Flash. (I assume you've known how to use flash basically)

  1. Create a MovieClip symbol from Library Panel, and drag it into the stage.
  2. Leave the instance name of this MovieClip on the stage blank.
  3. Create another new scene.
  4. Drag the MovieClip you created previously from the Library panel, and drag it into the stage in the new scene you create presently.
  5. On the stage in the new scene , you will still leave the instance name of this MovieClip blank.
  6. Debug Movie(Ctrl+Shift+Enter)
  7. 7) You should see in the Debug window that the number behind the "_level0.instance.(name)" steadily increases. And actually from the Movie, you've just only have two instances. (These increasing numbers are Flash created for you to temporarily located them, because you didn't give them names)

Below is the the sample result you may see from the experiment above:


Also you can try now do this experiment again, but give both instances in different scenes a name this time, then Debug Movie. Now you should see that in the Debug window, on the level0, the name of "_level0.instance.(name)" switch between each other all the time.

About Instance Family

No mater what type of symbol you create from Library panel, they are all called instances on stage in a Movie. ActionScript thinks every instance as an object, and this object has the potentiality to contain more other object. An initial object is the parent object, the one to be included in is the child object, meanwhile, if this child object also contains another object, then this child object takes the role of both parent and child object. Dose it sound abstract? Let's jump to another topic first, and talk about the real performing. In a gun shooting scene of a movie, you see the bullet was shot from person to person, and actually it's from person's gun to another. If we cut this scene into three parts, we'll get the part of person holding the gun, the part of the bullet which is shot out from the gun, and the part of the bullet falls on the aimed target. Are we going to make these three parts separated? No way. It will just make the job unprofessional, inefficient, and time-consuming. So what we'll do instead is put bullets inside of the gun, put the gun on the person's hand, and also another bullet on the aimed target (this is the tricky part, in order to make bullet look like it falls on the right position on the aimed target). Afterward, we got only one action to get this scene done, and actions precisely. Come back to our flash movie, we'll apply the same logic into ActionScript. A gun shooting scene in our flash movie, we'll get the object of the bullet placed in the gun, the object of the person holding the gun, and the object of this bullet falls on the aimed target. It will still sound silly to create these three objects to accomplish the task when we can do it actually by create an object which contains the second object, and this second object also contains the third object on the stage. By doing this, we have the benefit of working out of this project precisely, efficiently, and professionally, because in the feature, whenever we want to do the same thing, we'll just call this object come to the stage once, and this object will finish the task(all in one pack).

You can do these things in all instances(MovieClip, Button, Graphic). However, only the instance with MovieClip behavior type can independently act as a mini movie that has its own timeline. And an instance with Graphic behavior on the stage will not allow you to have ActionScript modifiable (why? How can a graphic have any motion? It's just a picture, a graphic!)

After you understand the Flash's scripting environment, we are going to have a little bit of trying on the next section.



--Index--
  
Project Log
New tips
(Jan 28th,2004)
Pass value of ASP querystring to FlashMovie rather useing loadVariables method.
Piano Chords Finder
(Oct 4,2004)
After a little tired of making flash for web, started making this music tool to entertain myself hee:)
New Tutorial
(Sep 19,2004)
Glad...Once I had topic about web programming. ActionScript is such a cute thing that gives designers so much imagination to explore.
player 3.0
(Sep 9,2004)
A new design from mp3 streaming player2.0, also add volume control.
Never imagine how you want to be creative.


Virtual Reality .What's new .Delphi .Asp   .Snippets&Resources .My articles
Flash Workshop .My Tutorials .My Tips .Feedback Log
Sound of Music .Latest works .My Compositions .My Performances
Color,Light,Visual What's new .Vector Art .Photo Fusion .My Stock
Physics .My Articles
Extras .Blog .Photo Album .Guestbook

Eloo Fiction Plant
Copyright 2004-2010©izlenim.com All rights reserved. 

- Last Update on: 25 December 2007 18:50:40 / Tuesday -