Toxiclab.org

The power of Action Script

19.4.2006, 12:44
Submited in: Flash | Total Views: 34892

In this tutorial you have a chance to learn how to create a simple Action Script example.When I drag my Movie Clip above the another Movie Clip, something happens. Let's see what!

Step 1

Open Flah, press Ctrl+J (Document Properties), set Fps (Frame per second) to 30fps.Width,Height and color set whatever you like and press Ok.





Step 2


Draw any "object", select it, press F8 key (Convert to Symbol) to convert that "object" into a Movie Clip Symbol. For this example I'll draw this:



Step 3

Select that "object", open the Action Script Panel (F9), and paste this script:

on(press) {
startDrag(this,false);
} on(release) {
stopDrag();
}

After that select again the "object" (Movie Clip), open the Properties Panel (Ctrl+F3 or F12), and for <Instance Name> type: object1. See the picture below.



Step 4

Create a  new layer, and draw again some "object" or type something. For this example I'll type this:



Step 5

Select that new "object", press F8 key and convert it into a Movie Clip Symbol.

Step 6

Take the Selection Tool (V), click once on the new made Movie Clip, to select it,open the Properties Panel (Ctrl+F3) and for <Instance Name> type: object2.



Step 7

Select again the Movie Clip ("object"), and in A.S.Panel (F9), paste this script:

onClipEvent (enterFrame) {
if (this.hitTest(_root.object1)) {
trace ("Mission Completed");
}
}

Download example (41 KB)

Are you a website owner?
Click here to register and submit your tutorials!

Browse by category


Most popular tutorials