1. Home
  2. Computing & Technology
  3. Animation

Flash Halloween Costume Dress-Up Doll II: Controls & Scripting

By Adrien-Luc Sanders, About.com

5 of 10

We’re going to use an on (release) to make the pieces appear and disappear with a mouse click:

on (release) {
_root.instancename._visible=!_root.instancename._visible;
}

This statement avoids the complications of conditional statements (if, if/else, etc.) and simplifies the process of determining and changing visibility using a logical NOT: it tells Flash that whatever the value of _root.instancename._visible, change it to the exact opposite, represented by !_root.instancename._visible. If it’s true, it changes to false; if it’s false, it changes to true, but we don’t have to actively determine which it is. No matter how many times you click, it still works to hide and unhide the target clip.

Make sure to change the instance name to correspond with the name that you assigned to the costume piece that matches the current menu option. Never forget the _root. in front of the instance name, so that Flash knows exactly where to look for the movie clip that it’s supposed to be referencing.

Now you’ll need to copy that code, then paste it into the Actions for each menu option, with the instance name changed accordingly in each one. When you’re done with all of them and on to the next step, give me a call. I’m going to go get some more coffee; you’re going to be a while.

Explore Animation
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Animation
  4. Flash Animation Tutorials
  5. Flash Halloween Costume Dress-Up Doll II: Controls & Scripting

©2009 About.com, a part of The New York Times Company.

All rights reserved.