Movie Clip Properties with AS 3.0

Movie Clip Properties with AS 3.0
One of the easiest ways to learn ActionScript in Flash CS3 is to first use the built-in features to perform a task and then write ActionScript code that will perform the same task. By comparing the two methods, you will gain a better understanding of how ActionScript works in Flash. In this tutorial, we will explore the properties for a Movie Clip object in the Properties Inspector and then write ActionScript code that will set values for these properties.

1. Start a new Flash document for ActionScript 3.0.

2. For the Oval tool, set the Fill to black and the Stroke to null. We are going to draw a snowflake.

3. While holding down the Shift key, click and drag to draw a circle at the top of the stage.

4. With the Selection tool, right-click on the circle. Choose Convert to Symbol from the menu. Name your symbol "mcSnowflake" and set the Type to Movie Clip.

You will notice that the mcSnowflake movie clip has been added to the Library Panel and the snowflake that we drew on the stage is now an instance of the mcSnowflake movie clip object. However, this instance still does not have a name. We need to give the snowflake on the stage a unique name for Flash and ActionScript to identify the instance.

5. In the Properties Inspector, change the placeholder Instance Name to "snowflake1_mc". While we are in the Properties Inspector, let's see what properties our snowflake has. As you can see, the snowflake that I drew has a Width and Height of 11 pixels. Because I drew the snowflake at the top of the stage, it has an X and Y position of 40 and 37.

6. Click Control, Test Movie to test our movie. The only thing that you should see is a small black circle at the top of the stage.

Continue





RSS
Related Articles
Editor's Picks Articles
Top Ten Articles
Previous Features
Site Map








Content copyright © 2019 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact Diane Cipollo for details.