Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
To modify an instance using ActionScript, you can use something called dot syntax. Don't let the name scare you though; dot syntax is simple and easy to learn, even for the newest programmers. On the stage I have an instance of a movie clip called boarder_mc. Make sure to create a movie clip instance and name it, just like mine is named here. Let's go to the first keyframe in the actions layer and open up the Actions panel. Dot syntax simply means you can modify an object's properties by typing a dot. The real special thing about dot syntax in Flash is that you can get code hinting when typing a dot.
To get code hinting, I am going to make a variable to hold the boarder on the stage. Now this may seem a little bit counterintuitive, because we have already given it an instance name, and I am not going to directly use that instance name to modify the boarder. I will show you why in just a second. Type var and then a space, and we will call this boarder, different from boarder_mc, which is the instance name of the border. I am going to data type this to a movie clip, and I am going to set it equal to boarder_mc. That's the name of the movie clip instance on stage.
Now here is why I do that. If I want to modify the boarder's properties, I'll just type boarder and then a dot. I can scroll through a menu, pick different properties and methods that I can apply to this object. Let's take a look at one of them. I am going to double-click on alpha. This value is a numeric value between 0 and 1 and controls the alpha transparency of an object. So if you want to bring its alpha down to 25%, then the value is not 25 - it's 0.25. boarder.alpha = 0.25. So I will test the movie, and you can see a semi-transparent boarder on stage.
Some other properties you can modify are x. You have seen that before in this title, so I can set it equal to 0, make the boarder go to the left edge of the stage. I can set it to 500 and move the character to the right. Another position property is Y, which controls the vertical position. If I set Y to 500, the boarder is at the bottom of the stage. If I set Y to 0, the boarder goes to the top. Finally, I would like to show you rotation, which allows you to, obviously, rotate an object, but keep in mind this is not animated rotation; this is just simply modifying the rotation property.
So I will set the value to 45, and you can see the boarder is rotated 45 degrees. You can go to -45. And keep in mind that values for rotation are between -180 and +180. Also, position and rotation are all relative to the registration point of the object. See here that the cross is at the top left of my movie clip. Let's say I were to create another movie clip. I will just take this trashcan and go Modify > Convert to Symbol, and this opens a Convert to Symbol dialog, which allows you to set the registration.
The default is top-left, but you can also set it to the center, the bottom-right or wherever you want. For the most part, you're going to want to keep registration at the top-left, but if you're ever going to rotate an object using ActionScript, especially if you are going to animate the rotation, you might want to have the object's registration point to be in the center. So, that's the XY origin of an object when you create it as a symbol. I am going to cancel out of that menu now. So wherever the registration point is, you can still manipulate the object using dot syntax. So to review, dot syntax allows you to manipulate objects by using a dot after the object's name, which opens the Code Hinting window for easy access to all the object's properties.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 101728 Viewers
61 Video lessons · 88489 Viewers
71 Video lessons · 72307 Viewers
56 Video lessons · 104022 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.