Visibility

I l @ ve RuBoard

Another property that you should know about is the _visible property. This property takes a simple Boolean value, true or false, and shows or hides the movie clip accordingly . Here is an example:

 myClip._visible = false; 

If you want to see this property in action, look at the example movie 07visible.fla. There are two buttons : one to set the _visible property to true, and the other to set it to false.

But suppose that you don't want the movie clip to completely disappear. You can set the transparency amount with the _alpha property. You can set this to any value from 0 to 100. Here is an example:

 myClip._alpha = 50; 
graphics/cup.gif

The _ alpha property of a movie clip refers to the fourth color channel, also called the alpha channel. The first three color channels are red, green, and blue, which are the three colors needed to create the full rainbow of color. The fourth channel is the amount of transparency for that particular pixel.

You'll see reference to the alpha channel in software such as PhotoShop, Illustrator, and Fireworks.

When you hear that a graphic is 32-bit, this refers to the fact that there are four color channels, each taking up 8 bits of data. A 24-bit image means that there are only red, green, and blue channels.


When you set an _alpha to 0, the movie clip is completely transparent. When you set it to 100, the movie is completely visible and opaque . When it is transparent or semitransparent, anything behind it partially shows through.

Figure 7.6 shows the same movie clip three times. The first one on the left is with an _alpha setting of 100. The last one on the right has an _alpha setting of 10, which makes it barely visible. The middle one is at 50.

Figure 7.6. The same movie clips, but each at a different _alpha setting.

graphics/07fig06.jpg

I l @ ve RuBoard


Sams Teach Yourself Flash MX ActionScript in 24 Hours
Sams Teach Yourself Flash MX ActionScript in 24 Hours
ISBN: 0672323850
EAN: 2147483647
Year: 2002
Pages: 272

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net