Movie Clip Properties with AS 3.0 - 2

Movie Clip Properties with AS 3.0 - 2
But snowflakes are not black. Now we will write some ActionScript to set the Alpha property value for our snowflake to a transparency of .2. In ActionScript 3.0, the Alpha value can be between 0 (100% transparent) and 1 (100% opaque). By setting the Alpha value to .2, our snowflake will be 20% transparent.

When coding in ActionScript, we will usually want to add our code to Frame 1 on a new actions layer in the Timeline. So, let's add a new layer to the Timeline.

7. Click on the Insert Layer button in the Timeline and rename our new layer "actions". The new actions layer will automatically be the top layer in the Timeline and we should be on Frame 1.

Now click Window, Actions to open the Actions panel. Because we are working on Frame 1 in the actions layer, the tab at the bottom of the panel should say actions:1. Click within the Script pane to begin the first line of code.

8. We need to tell Flash what instance of the snowflake we want to control with the code. Type "snowflake1_mc" on the first line. Next, add a period after the instance name to tell Flash that something more will follow.

snowflake1_mc.

9. We will tell Flash that we want to set a value for the Alpha property. Add "alpha" after the period.

snowflake1_mc.alpha

10. Finally, we will set the Alpha value. Add a space after "alpha" and type "= .2;" to finish the code. This will set the Alpha to 20%.

snowflake1_mc.alpha = .2;

11. When we test our movie again, we should see a nice light gray snowflake.

Copyright 2018 Adobe Systems Incorporated. All rights reserved. Adobe product screen shot(s) reprinted with permission from Adobe Systems Incorporated. Adobe, Photoshop, Photoshop Album, Photoshop Elements, Illustrator, InDesign, GoLive, Acrobat, Cue, Premiere Pro, Premiere Elements, Bridge, After Effects, InCopy, Dreamweaver, Flash, ActionScript, Fireworks, Contribute, Captivate, Flash Catalyst and Flash Paper is/are either [a] registered trademark[s] or a trademark[s] of Adobe Systems Incorporated in the United States and/or other countries.

Back





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.