Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
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
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.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 101561 Viewers
61 Video lessons · 88320 Viewers
71 Video lessons · 72184 Viewers
56 Video lessons · 103939 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
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.
Your file was successfully uploaded.