Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com�s entire library of video tutorials.
The methods and properties covered in this section of the tutorial let you control and test almost all aspects of objects on display on the Stage; the parents, rotation, alpha, filtering, blending, masking and more. These are all the fundamental tools for animating objects entirely using ActionScript. The process of animating using ActionScript actually starts by creating a motion tween on the Stage by moving a display object between keyframes along the timeline. This will quickly and easily create your animation. A motion tween modifies display object properties such as position or rotation on a frame-to-frame basis. A motion tween can also change the appearance of a display object while it moves by applying various filters and other properties. Flash now automatically generates the ActionScript that describes the motion in the tween. This script can then be copied into memory and then pasted to animate another object in the same file or in another FLA file. Start off by creating the motion tween as you would normally on the timeline. I have an example here of three motion tweens of, I've hidden two of them so we can just look at one at a time here. So there is the motion tween of a spinning and changing scale of a rectangle. Now Flash can automatically generate the ActionScript that can repeat this exact same motion. You can get Flash to copy this ActionScript by right-clicking on the timeline right there and then choosing from the contextual menu here: Copy Motion As ActionScript 3.0. Flash requests you to provide an instance name. Let's call this star underscore mc. This is the name of the object, the movie clip object that I'll create either in another location in this file or in another Flash file. Click OK and Flash went ahead and copied all that script into memory under my clipboard here in the Windows OS. So now open up a new Flash movie so we can copy that animation to another object. Create two layers, Actions and Layer2 is going to be labeled start, like so. Create a star graphic using the Graphic Creation Tools in Flash. Double-click on the graphic to select both the stroke and the fill and then convert that to a movie clip. The next step is the most crucial and probably where you'll make a mistake if you make one. Open up the Properties Inspector, select that new instance and give it the same instance name as the name you were prompted for earlier when Flash copied the script. That was start underscore mc. I meant to call it star but it actually was labeled start with a t. Make sure that's spelled correctly. Now you simply open up the Actions Panel here in Frame 1 of the Actions Layer. Do a Ctrl-V or right-click and just choose Paste from the contextual menu there to paste the text that's in memory right into the Actions Panel. And now let's do a Control, Test Movie and you can see there's the same animation, a spin and a change in scale. So the motion was copied to the ActionScript which now allows me to transfer that motion over to any object in the same file or in another file as long as that object has the same instance name, right there, start underscore mc. Note that whereas the motion tweens and shape tweens that you previously created were created before playback, ActionScript-based animation is created during playback so that it can respond and change according to user choices and actions. This technique lets you create movement by setting up motion interactively in the Flash file, then using that motion to create a dynamic ActionScript-based animation at runtime. For example, you can use the mouse location properties, mouseX and mouseY, so that the location of the user's mouse determines the behavior and appearance of the animation as it's being displayed on the stage and clearly this is an important technique for any Flash designer to learn and master. So, let's spend some time in the next several movies going over some of the basics. The automatically generated ActionScript code that implements a motion tween does each of the following: it instantiates a motion object for the motion tween; it sets the duration of the tween; it adds the properties of the motion tween; adds filters; and then associates the motion tween with its display object or objects. Now a tween generates intermediate frames that show a display object in different states in two different frames on a timeline. It creates the appearance that the image in the first frame evolves smoothing into the image in the second frame. In a motion tween the change in appearance typically involves changing the position of the display object that's creating movement. In addition to repositioning the display object however, a motion tween can also rotate, skew, resize, or apply filters to it. There are actually two ways to access the copy motion as ActionScript command in Flash. First way is to right-click on the Stage or the timeline, the actual motion tween and then choose Copy Motion as ActionScript 3.0 from the contextual menu, or you can select the motion tween and then choose it directly from the Flash Edit Menu. Edit, Timeline, Copy Motion As ActionScript 3.0. Notice then you get the chance to name the instance in the ActionScript. Again, after copying the script you can then paste it into a file and save it. Now the header in the ActionScript code that you copy from Flash lists all the modules required to support the motion tween. You can see this in the code that we pasted previously in our test file. You can use the animation as is or you can modify it to create your own dynamic ActionScript-based animation. That's really the key technique, is to start with an animation that you create on the timeline and then modify it using the provided ActionScript. Now to modify it you're going to need to use a variety of motion tween classes including Animator Factory, Motion Base and Motion Classes, so now let me move on to the next movie and review some of the more important of these motion tween classes.
| Course: | Adobe Flash ActionScript 3.0 for Designers |
| Author: | James Gonzalez |
| SKU: | 34060 |
| ISBN: | 1-935320-82-3 |
| Release Date: | 2009-11-09 |
| Duration: | 9.5 hrs / 101 lessons |
| Work Files: |
Yes |
| Captions: | No |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |