-
What does NaN mean? How do you fix this?
Hello, I'm having trouble with my coding. Upon clicking on a button I would like my movie clip to appear and subtract 1 from my variable. My variable is called 'woo'. My movie clip is called 'mydays'. Here is the code:
Code:
on (release) {
if (_root.mydays._visible) {
_root.mydays._visible = false;
} else {
_root.mydays._visible = true;
}
}
on (release) {
if (day < 30) {
day += 1;
hp += 50;
} else if (day = 30) {
gotoAndPlay ("endofgame")
}
}
on (release) {
_root.mydays. woo -= 1;
}
Every time I test my button, my movie clip appears as I want it to but the variable says NaN. What does this mean? How can I fix this?
-
NaN means "not a Number".
Is your variable inside your MC??
Can´t understand this code.
Attach the file.
-
Dignitary
You need to assign a number to a variable before you try to use it in math.
Code:
_root.mydays.woo =100;
on (release) {
if (_root.mydays._visible) {
_root.mydays._visible = false;
} else {
_root.mydays._visible = true;
}
}
on (release) {
if (day < 30) {
day += 1;
hp += 50;
} else if (day = 30) {
gotoAndPlay ("endofgame")
}
}
on (release) {
_root.mydays.woo -= 1;
}
-
Yes my variable is inside my movie clip. The file is too big for me to attach it.
-
Never mind, I figured out what was wrong. Thanks for helping!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|