PDA

View Full Version : _global??



earph
August 21st, 2003, 06:25 PM
If I set my "_global" like this:

_global.button.gettingStarted2 = true;

I thought I'd be able to clear it like this:

for (var button in _global) delete _global[button];

But it's not working. Does that "clear"statement look correct?

What's wrong here?

Thanks!

senocular
August 21st, 2003, 06:56 PM
dont use "button" Its already a keyword (object) in Flash. A button is a Flash button - the Button object. You can't (nor would you want to) delete that.

earph
August 21st, 2003, 07:58 PM
BUT.... if I use another word it should work fine, right?

λ
August 22nd, 2003, 05:14 AM
also, there is no need to use a for...in loop. You can just simply say delete global.button

earph
August 22nd, 2003, 11:15 AM
Now my "_globals' straight up quit working. Here's what I'm doing....

BUTTON
-----------------------------------
on (release){
delete _global.navButtons
_global.navButtons.gettingStarted2 = true;


FRAME
-------------------------------------
this.onEnterFrame = function() {
if (navButtons.computerSetup2) {
this.gotoAndStop(10);
} else {
this.prevFrame();
}
}
};
-------------------------------------------------------------

Shouldn't that work? Am I calling my "_global" the right way? It actually worked before I started putting all the "navButtons" with the "_global"....

senocular
August 22nd, 2003, 11:18 AM
delete _global.navButtons
_global.navButtons.gettingStarted2 = true;

^ how can you expect to assign gettingStarted2 in navButtons if you just deleted navButtons?

earph
August 22nd, 2003, 11:21 AM
Well.... I did that to clear the _global to turn all the buttons off, then assign that one button on.

Know what I mean? Should I do it another way?

earph
August 22nd, 2003, 11:21 AM
It's been working fine till I put "navButtons" into the equation.