Today’s Neat F2k4 Style Property: modalTransparency

Went digging and found this neato property:

_global.style.modalTransparency = 50;

When you create a pop-up (remember my disable the entire movie code?), it creates a fullscreen movie clip so you can create modal dialogues. However, I couldn’t see it, and thought that was kind of dumb, so went looking to see how the PopUpManager created it. It’s a lazy use of a property; if it’s there, it uses it. So, if you do the above, it’ll be a hazy white. Pretty cool!

Full kizz-node:
– put a Button on stage
– put an Alert on stage
– delete the Alert
– use this code on frame 1

import mx.managers.PopUpManager
import mx.controls.Alert

_global.style.modalTransparency = 50;
PopUpManager.createPopUp(this, null, true);

Optionally, you could replace null with Alert, but the point here is just to see the transparency difference. One thing of note, however, is you cannot “animate” using this property. I tried an onEnterFrame of it, but it merely sets the mc’s alpha via this property, nothing more. If you wish to animate the modal blocker’s alpha or color, you’ll have to get a reference to the mc by modifying the createPopUp method to return a refernce to the movie clip. Just don’t distribute the code… it’s against Macromedia’s EULA, hehe!

2 Replies to “Today’s Neat F2k4 Style Property: modalTransparency”

  1. Verry nice!
    But how to change the color of the transparent movie clip that give the modal effect?

    Now the transparency is from white.

    Thank’s and regards :)

    By the way, nice site you have here!!

  2. Thanks!

    It’s called ‘Modal’ and it’s in the StandardCompents.fla (or the Halo.fla) in your Configuration folder. Simply copy it to your movie, colorize it, and republish.

    C:\Program Files\Macromedia\Flash 8\en\Configuration\ComponentFLA

Comments are closed.