A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: if (x==0) { not working

  1. #1
    Member
    Join Date
    Jul 2002
    Posts
    72

    Red face

    Sorry to ask what may be obvious but I can't get this to work.

    I have an if statement that works great if I place it on a button On press

    However I want that same satement in the last frame of a movieclip to direct the next action.

    It seems like if statements are ignored unless attached to an event - is that true?

    What am I doing wrong?

    Thank you.

  2. #2
    HELP>>>ACTIONSCRIPT DICTIONARY
    Join Date
    Feb 2000
    Location
    In the Present Moment
    Posts
    1,041
    Conditional statements on a frame action will work, no problem. Just make sure that you are properly addressing the variable you want to check.

    Did you cut and paste the code from the button and place it in a movieclip? was the button in that movieclip? If not, did you remember to change the scope of the variable you were checking?

    First Frame:

    n++;

    Last Frame:

    if(n<10){
    gotoAndPlay(1);
    }else{
    stop();
    trace("I'm Done");
    }

    Good Luck!

  3. #3
    Member
    Join Date
    Jul 2002
    Posts
    72
    Thanks for helping

    Sorry - I figured it out - In testing the submovie, the variable isn't declared so it only works when called from the main movie.

    Moo Moo Moo
    [Edited by jim2002 on 08-14-2002 at 11:05 PM]

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