Help with Boolean in Actionscript 2 being undefined
4 replies, posted
[url]http://pastebin.com/XGNaCueP[/url]
That's all the code. The only variable you need to worry about is the "meow" boolean. If you look to the top, I define the meow Boolean, and it's global. If you look to the onLoad() function, I clrealy defined the variable as "false".
The issuse is:
On function onEnterFrame(), I have the button setup as kk, and when I press it, it traces "press" and the value for meow. The problem is, meow returns as undefined, but in OnLoad(), it's clrealy defined. This doesn't happen with any other variables.
Help?
[code]
_root.kk.onRelease = function()
{
...
}
[/code]
I don't know ActionScript 2, but I assume this function won't have access to the meow variable, since it's not part of the class.
[QUOTE=dajoh;33746772][code]
_root.kk.onRelease = function()
{
...
}
[/code]
I don't know ActionScript 2, but I assume this function won't have access to the meow variable, since it's not part of the class.[/QUOTE]
[code]
var velocity; // Creates a variable (like a int in C++/Java/etc) that stores a #
var shootLimit;
var meow:Boolean;
var enemyTimer;
var enemies;
var score;
var health;
var highscore;
var enemyTimerLimit;
var healthPowerUpTimer;
var playingGame:Boolean;
[/code]
All of those variables are not defined in a function, so they are global. That's why every variable but meow works for some odd reason.
Also, if I trace it with "trace(meow)" and it wasn't allowed to be used in that class, it would spit out an error.
Do you ever initialize the boolean?
[QUOTE=_Twitch_;33746970]Do you ever initialize the boolean?[/QUOTE]
They are initialized automatically to be "undefined" but I set the value to false, and it still returns as undefined... :P
Sorry, you need to Log In to post a reply to this thread.