How-To Use Actionscript (for AS beginners, like myself)

Actionscript. I’m not going to lie, learning it seems to be a bit of a pain…especially because it reminds me of Visual Basic, which I’m taking a course in (it counts as a quantitative and formal reasoning for those of you who still need a math requirement! Okay..enough about me. Let’s move on to the tutorial, shall we?)

This week, I’m going to show you a simple actionscript phrase and how to use it, “stop”. Next week, we will be learning how to create a click event and make something move on cue, whenever the user clicks or mouses over it (trust me, it is much more simple than you think.)

First off, choose the “Essentials” workspace (upper right hand corner, by the maximize, minimize, and exit buttons.) Now, go to Window, then click on Actions. You’re going to want to dock this somewhere in your workzone. I placed it with properties and the library (by use of dragging and dropping there.) My workzone looks like this. (If you notice that where you’re workzone says “Essentials” that mine says “ActionScript Essentials”. Don’t worry about this, I just customized my workzone. If you want to do this after you add and position all of your windows, just click “Essentials” or whatever zone you’re working in and click “New Workspace”. Then you have your own customized workspace that you can open whenever you like!

Okay, start off with a stage. You can import a picture or do whatever you want..I’m going to draw a simple rectangle in flash. Name that layer (mine is pinktangle)! I also imported a picture for my background..just because I’m not a fan of white space (also because who doesn’t love rectangles in the ocean? I know I do.)

Next, you’re going to want to add some frames…I added about 40. An easy way to do this is to select the frame you want to end on and hit F5 on the keyboard. Okay, now we are going to add a motion tween to our rectangle (if you do not know what this is, I suggest you revisit this link to refresh your memory.)

Here’s what I have so far:

Now, click on the ending frame if you haven’t already. Next, you’re going to click on the 3D Rotation tool (fourth tool down on your toolbar.) Rotate your rectangle in whatever way you want (x axis, or y..make sure you’re clicking on the green bar on your image in order to rotate).

Let’s test our movie so far. Go to Control, Test Movie. A Shortcut for this is Ctrl+Enter on the PC or Command + Return on a Mac. As you can see, we have a neverending object. the rescue.

Let’s create a new layer. Rename it “Scripts” or “Actions”…or even, dare I say…”ActionScript.” Okay, enough humor. Now you’re you going to click on your final frame…go to your actions panel and drag it out a bit, so you can see what you’re typing.

Now write this code exactly as you see it in bold below:


It should look like this:

Notice two things. On the first blue arrow, a scripted, lowercase “a” appears. This denotes that there is actionscript on that layer. Also, on the second blue arrow, you see that the word “stop” is in blue. This is to let you know that this is correct syntax.

Okay, we are almost complete! Now, select the first frame, with the script a and move it to the last frame. Your layer should now look like this:

Okay, now test your movie! As you can see, the object only makes one full rotation and then stops. Congrats, you’ve just mastered a bit o’ actionscript!

Go check out the finished product here under Digital Composition, How-To Blogs…DIY Blog 12!


Tiffany Nebraska


~ by spiffytiffy2009 on March 29, 2010.

%d bloggers like this: