Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Communicating to MovieClips

From: ActionScript 3.0 in Flash CS3 Professional Essential Training

Video: Communicating to MovieClips

In this chapter I'm going to explain how to communicate with different objects and with yourself or with others using ActionScript. So the first thing that you need to understand about communication is how to set up communication to a movie clip. So let's open up the Welcome screen in Flash CS3 and select Flash File (ActionScript 3.0) under the Create New section. And that will create a new Flash document for you. Now what I'm going to do is I'm going to draw a simple object on the Stage and set everything up so we can communicate to this object with ActionScript. And what do I mean by communicate? Let me show you in just a second after we convert this object into a movie clip.

Communicating to MovieClips

In this chapter I'm going to explain how to communicate with different objects and with yourself or with others using ActionScript. So the first thing that you need to understand about communication is how to set up communication to a movie clip. So let's open up the Welcome screen in Flash CS3 and select Flash File (ActionScript 3.0) under the Create New section. And that will create a new Flash document for you. Now what I'm going to do is I'm going to draw a simple object on the Stage and set everything up so we can communicate to this object with ActionScript. And what do I mean by communicate? Let me show you in just a second after we convert this object into a movie clip.

So I'm going to go over to the Rectangle tool, and I'm going to select a Fill color, whatever you want, I'm going to go for a green. And you can select a stroke color if you want or no stroke color, it doesn't matter. Go onto the Stage with your mouse and click and drag to draw a rectangle of any size, any width, any height. Now what I'm going to do is convert this object into a movie clips. So I'm going to go over here to my Selection tool in the top left of my screen, or press V on my keyboard, and I'm going to draw a selection area around this whole object. You can tell that it's selected by the white dots that are all over it.

Then I'm going to press F8 on my keyboard, or go to Modify, Convert to Symbol, to convert this rectangle into a symbol. I'm going to call it mc and then Rectangle, with a capital R. Now if you've used Flash for a while you might already know the naming conventions or what's legal and what's not legal to put as a symbol name. Now mcRectangle is totally legal. Usually you want to start with a lowercase letter, sometimes you want to start with an uppercase letter, and what you want to do is not give any spaces or any special characters, and by special characters I mean ! ? etc. So this instance name is okay. Verify that Movie clip is selected in the Type area, and let's keep Registration at the top left and then click OK.

So now you have a movie clip on the Stage. Now let's just deselect that by clicking this gray area to the left of the Stage and there should no longer be a blue rectangle around your square or your rectangle. And then click it again, click your rectangle again and then look in the Properties Inspector that's at the bottom of the screen. So it should say Movie Clip and should have these open brackets and say . It's kind of gray in that area. If you click in the area, you can give it an instance name. So I am g oing to give this instance name of rectangle_mc.

Now there's a special naming convention I'm using here. I'm giving it a name, starting with a lowercase letter. Again for an instance name you want to follow basically the same naming convention of giving it no spaces, no special characters. Giving it the suffix of _mc will help me out in the future, and I'll show you that in the next video what the difference it makes. Now what I'm going to do is click on this movie clip on the Stage and I'm going to go to my Free Transform tool, or press Q on my keyword, and then you should see all these rectangles all around, these little boxes. So if I go over to the bottom right of my rectangle and I click and I drag you can rotate this thing around, and I release the mouse it's rotated, and I can click any of these other handles and resize or rotate or whatever I want.

I can grab different instances out of the library. So now I have three rectangles on the Stage. I'm going to modify this one a little bit as well, this bottom right one. I'm going to go to the Color in the Properties Inspector, select the drop-down, select Tint. I'm going to choose a random color. My random color is going to be blue and I'm going to give this a blue tint. So we have three different instances on the Stage. Now this is the most important thing that you need to understand about communication for right now. In the Library this is called mcRectangle. If I wanted to communicate to these objects with ActionScript or modify the rotation or the transparency or the color or anything, I need to give them an instance name, because as far as Library is concerned, this is mcRectangle, this is mcRectangle, this is mcRectangle. The instance name is what differentiates the objects from one another. So now that we have an instance name on this rectangle_mc, we're ready to communicate to it or to modify its properties using ActionScript. So let's do that in the next movie.

Show transcript

This video is part of

Expand all | Collapse all
  1. 2m 3s
    1. Introduction
      39s
    2. How to use the exercise files
      1m 24s
  2. 3m 53s
    1. Why you should learn ActionScript 3.0
      52s
    2. Differences from ActionScript 2.0
      1m 56s
    3. Moving beyond Script Assist
      1m 5s
  3. 21m 57s
    1. Communicating to MovieClips
      4m 7s
    2. Modifying MovieClips properties
      7m 0s
    3. Understanding variables
      50s
    4. Setting variable data types
      3m 23s
    5. Using trace statements
      2m 39s
    6. Using comments
      3m 58s
  4. 26m 3s
    1. Understanding functions
      1m 23s
    2. Using functions
      2m 27s
    3. Writing custom functions
      4m 25s
    4. Making a function modular
      11m 50s
    5. Making a function return a value
      5m 58s
  5. 41m 45s
    1. Understanding event types
      1m 28s
    2. Using a listener to catch an event
      3m 14s
    3. Writing event handlers
      6m 56s
    4. Responding to mouse events
      4m 33s
    5. Responding to keyboard events
      5m 45s
    6. Creating a link to a website
      5m 26s
    7. Using the enterframe to create animation
      7m 34s
    8. Using the timer event to control animation
      6m 49s
  6. 44m 32s
    1. Understanding classes
      1m 48s
    2. Writing a custom class
      4m 21s
    3. Extending an existing class
      2m 16s
    4. Understanding methods
      2m 11s
    5. Public vs. private properties and methods
      2m 46s
    6. Bringing a class object to the timeline
      14m 16s
    7. Defining a document class
      8m 13s
    8. Setting up a classpath
      6m 20s
    9. Creating useful classes
      2m 21s
  7. 36m 4s
    1. Understanding conditional statements
      1m 36s
    2. Writing a conditional statement
      4m 40s
    3. Understanding conditional operators
      1m 37s
    4. Using conditional operators
      4m 49s
    5. Setting up alternate conditions
      4m 43s
    6. Writing compound conditions
      4m 22s
    7. Understanding loops
      1m 30s
    8. Creating a code loop
      2m 58s
    9. Using a loop to generate instances of a class
      3m 44s
    10. Placing loop-created instances
      6m 5s
  8. 12m 49s
    1. Understanding the math class
      1m 5s
    2. Using basic math operators
      1m 46s
    3. Generating random numbers
      2m 15s
    4. Using different techniques to round numbers
      7m 43s
  9. 56m 20s
    1. Creating a text field
      3m 27s
    2. Styling a text field
      6m 28s
    3. Capturing data from a text field
      7m 38s
    4. Loading external text
      8m 25s
    5. Scrolling a text field
      5m 14s
    6. Understanding arrays
      9m 48s
    7. Using text and arrays to create a game
      8m 24s
    8. Finishing the text game
      6m 56s
  10. 1h 9m
    1. Storyboarding your application effectively
      3m 13s
    2. Writing a memory card class
      5m 57s
    3. Writing a memory game class
      3m 51s
    4. Adding graphics to cards
      9m 20s
    5. Placing cards
      7m 33s
    6. Detecting matches
      8m 40s
    7. Resetting cards
      4m 53s
    8. Handling incorrect matches
      5m 14s
    9. Determining a win
      3m 51s
    10. Adding additional cards
      6m 47s
    11. Randomizing cards
      10m 17s
  11. 36m 30s
    1. Drawing with code
      8m 12s
    2. Creating a color change
      5m 20s
    3. Generating a random color change
      6m 58s
    4. Animating a color change
      4m 50s
    5. Using filters
      3m 30s
    6. Modifying filter properties
      4m 13s
    7. Animating filters
      3m 27s
  12. 51m 50s
    1. Loading external images and Flash movies
      4m 1s
    2. Communicating to loaded movies
      6m 31s
    3. Loading sound
      4m 6s
    4. Starting and stopping sound
      6m 18s
    5. Pausing and resuming sound
      9m 46s
    6. Managing the volume of sound
      5m 41s
    7. Understanding Flash video connections
      1m 0s
    8. Loading video
      5m 33s
    9. Controlling video playback
      8m 54s
  13. 45m 54s
    1. Overview of creating a drag-and-drop game
      57s
    2. Creating drag-and-drop class
      12m 7s
    3. Detecting collisions
      8m 44s
    4. Responding to collisions
      9m 1s
    5. Detecting a win
      4m 2s
    6. Adding drop shadows
      3m 43s
    7. Randomly placing objects
      7m 20s
  14. 23s
    1. Closing
      23s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed ActionScript 3.0 in Flash CS3 Professional Essential Training.

Return to your organization's learning portal to continue training, or close this page.


OK

Course retiring soon

ActionScript 3.0 in Flash CS3 Professional Essential Training will be retired from the lynda.com library on October 10, 2014. Training videos and exercise files will no longer be available, but the course will still appear in your course history and certificates of completion.


Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.