Easy Flash Question..for real
- Started
- Last post
- 8 Responses
- K_Fresh
SO... I'm loading one movie clip ontop of another yet I don't want the buttons in the clip in the lower level to be active.
What is the best way to disable them while the movieclip on top is loaded? I'm not a super AS pro so break it down for this sad case...
THx!
- SmilingBuddh0
In MX or higher, you can give the buttons instance names, then toggle their enabled property:
mybutton.enabled = false;
mybutton.enabled = true;
- K_Fresh0
Yeah...that's what my feeble mind was thinking...but then I thought there might be an easier way...disabling the entire .swf rather than disabling each button manually. Make any sense?
- SmilingBuddh0
It makes sense. Ideally, you could do something like this:
for (n in mymovie) {
if (typeof(mymovie[n]) == 'button') {
mymovie[n].enabled = false;
}
}But 'button' isn't an object class as far as the typeof method is concerned (it traces as 'object'). If we go ahead and do it anyways with 'object', we end up inadvertently creating a bunch of un-needed properties for other objects.
Two options, then:
1) Create an array with all of your buttons in it
mybuttons = [button1, button2];
and a function to turn them off:
buttonsOff = function() {
for (n in mybuttons) {
mybuttons[n].enabled = false;
}
}2) This is a bit of a hack, but will turn off all buttons in a given MC's scope:
toggleButtons = function (mc) {
for (n in mc) {
if (typeof (mc[n]) == 'object' && mc[n].enabled != undefined) {
mc[n].enabled = (mc[n].enabled) ? (false) : (true);
}
}
};
- Mick0
Bwfore MX came out I used to have a key frame in my main timeline where the buttons were not shown (or change from a button instance to a single frame graphic... then when loading the new level just make the main timeline goto that frame where the buttons were off.
- smoothblend0
an easy yet lazy solution would be to make another set of buttons on the movie clip your loading up, over the top of the old clip. Lazy but it gets the job done.
did that make any sence? man i need sleep..
- jpea0
but they'd still be able to click on the buttons because the ones underneath would be active. Everything on a level below is still available, even if you can't see it.
- K_Fresh0
You guys are wicked..I have try some of these suggestions out. Yeah..I thought about the lazy method too. Like...putting a big dynamic text field overtop of everything so you can't click beneath but that's kinda cheese.
My main problem is that its fuckin with my tabIndex in my email form. I try and tab to the next field and it's like "what up buttons underneath?"
Thanks all of you!!
- PrayStation0
the big button trick works well...
myBigButton.usehandcursor = false;
as long as it's above all the other buttons this button would negate all the buttons below it.