Easy Flash Question..for real
Out of context: Reply #3
- Started
- Last post
- 8 Responses
- 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);
}
}
};