Home
Username:
Password:
Adobe Flash ActionScript 3.0 for Designers Tutorials

Controlling Multiple Timelines / Targeting Timelines Using the with Action




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.


Learn More

Subtitles of the Movie

Let's close out this section of the tutorial with an alternative method for targeting movie clips. Another way to target both movie clips and other objects is to use the With Action. Instead of creating multiple target paths to the same movie clip, you can use the With Action to target a movie clip only once. Imagine that in our clock movie we wanted to make one of the clock hands both stop and shrink 50 percent. We would do that by targeting the movie clip three times and then writing the action, in this case stop or scale X and scale Y equals .5. That'll shrink it 50 percent. Now, another way to do this is to use this syntax; with and then go ahead and target the instance just one time and then go ahead and write the actions below that like so. Here we're temporarily setting the scope to the Clock underscore Hour movie clip so the method and properties between the curly braces affect only this particular path. When the action ends, any subsequent statement refer only to the current timeline. So in this case, I'm right here in the main timeline. Anything I wrote below down here would affect only the main timeline. Let me go ahead and delete all this line of code here since I don't need it twice. You can also find this working code in the file Target underscore Clock underscore Hands underscore With in the Work Files folder. We go ahead and do a Control Test Movie. You'll notice that the hand there is still moving but it's been shrunk 50 percent. I can also take out the remark right there and stop it. I get a little error message that says this method stop is no longer supported so to avoid getting that error I took it out but it is stopped. Let's now go back and play around with the scale property. Let's remark back on stop. Let's scale this, instead of .5 to 5, this is going to increase the size of the hour hand five times. And you can see there it is very big. I can also just change one of the scales. Let's just scale this X equals 5. So go ahead and play around with this, introducing a new property. You can see this because I'm only scaling in one direction. It's getting a little bit funny as it spins around the clock face but I can also target different movie clips. You can also practice that. For example, let's go ahead and use the Target Path Tool and let's target the seconds hand right here like so. I'm using a relative path, Control Test Movie and notice that now it's the seconds hand that's been altered. Let's change this to 1.5 and this to .5. In other words, I can just experiment around and get different effects here. That's kind of an interesting effect on that second hand. So there you have an alternate way of pathing to your various movie clips using the width method. That will conclude this section of the tutorial on controlling multiple timelines without ActionScript. In this section you learned about the movie clip class, the Target Path Tool, how to write absolute and relative paths as well as how to target timelines using the With Action. Let's now move on to the next section of the tutorial, Communicating through the Web Browser. Let me introduce you to our next project; how to script preloader animations that your users won't have to wait looking at a blank screen while the rest of your Flash file downloads.

Tutorial Information

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: Available on CD and Online University
Compatibility: Vista/XP/2000, OS X, Linux
QuickTime 7, Flash 8

VTC Sign up & Benefits

  • Unlimited Access
  • 98,729 Video Tutorials (23,265 free)
  • Video Available as Flash or QuickTime
  • Over 1026 Courses
  • $30 for One Month Access
  • Multi-User Discounts Available