A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: What does NaN mean? How do you fix this?

  1. #1
    Member
    Join Date
    Jul 2012
    Posts
    71

    Question 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?

  2. #2
    Junior Member
    Join Date
    Jul 2012
    Posts
    14
    NaN means "not a Number".
    Is your variable inside your MC??
    Can´t understand this code.
    Attach the file.

  3. #3
    Dignitary rynoe's Avatar
    Join Date
    Jan 2003
    Location
    Earth
    Posts
    760
    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;
    }
    [SIGPIC][/SIGPIC]

  4. #4
    Member
    Join Date
    Jul 2012
    Posts
    71
    Yes my variable is inside my movie clip. The file is too big for me to attach it.

  5. #5
    Member
    Join Date
    Jul 2012
    Posts
    71
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center