dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: If and else statements HELP

  1. #1
    Junior Member
    Join Date
    Nov 2009
    Posts
    12

    Question If and else statements HELP

    my script:

    if (coins == 0) {
    gotoAndStop(1);
    }

    and it doesn't work.
    The script is on a Movie Clip and the variable "coins" appear on the game like "Coins: <coins>". I don't know if it changes something, but just to you guys know. So, whats the problem?

  2. #2
    var x:Number = 1; x /= 0;
    Join Date
    Dec 2004
    Posts
    549
    Umm...could you post your code or the .fla or something? You haven't really provided a lot of information to go off of.

  3. #3
    Senior Member
    Join Date
    Aug 2000
    Location
    Montral
    Posts
    14,141
    a wild guess, try if(_parent.Coins==0)
    since the if is IN a movieclip and the variable is declared ON the main timeline (the _parent of the movieclip).
    Also Coins and coins are 2 different variables. make sure you spelled it right.

    gparis

  4. #4
    Junior Member
    Join Date
    Nov 2009
    Posts
    12

    Question

    Okey... I changed not the variable to " Coins ".
    I tried what ZippyDee said but it didn't work or I did something wrong.
    I uploaded the map so you guys can help me cuz i'm tired of the problem.
    Thank you.
    Attached Files Attached Files

  5. #5
    :
    Join Date
    Dec 2002
    Posts
    3,518
    Code:
    if (_parent.Coins == 2) {
    	_parent.gotoAndStop(1);
    }

  6. #6
    Junior Member
    Join Date
    Nov 2009
    Posts
    12
    Quote Originally Posted by dawsonk View Post
    Code:
    if (_parent.Coins == 2) {
    	_parent.gotoAndStop(1);
    }
    Ahaaa!! Thank you!

Tags for this Thread

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