A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: if statement???

  1. #1

    if statement???

    Sorry if I am asking to many questions at once- I am having trouble with my if statement. It should only work when it is on 1,2,3,4,5,6,7,8,,9,10 but it also works when men is on frame 23 -Where did I mess up.

    on (press) {
    if (_root.men._currentframe == 1||2||3||4||5||6||7||8||9||10 ) {
    _root.men.bottom = bottom[1];
    _root.men.top = top[1];
    _root.men.gotoAndPlay(23);
    _root.men.port.gotoAndPlay(2);
    }
    }

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    you'd have to say:
    if (_root.men._currentframe == 1||_root.men._currentframe == 2 etc...

    I'd suggest:
    if (_root.men._currentframe <=10)

    gparis

  3. #3
    thank you thank you thank you

  4. #4
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    The way you have it coded, you are asking if the MC "men"'s timeline is on frame 23. I guess that is what you want, but the || is wrong...well, the context and idea are correct, but the way it is written it is not sure what to do after the first statement. Basically, in lamens terms, you are asking:
    Code:
    if( the current frame of the MC called 'man' is on frame 1 || sdfsf || sdfsdf || sdfsdf
    The sfdsdf is just what it is...incoherent and unrecognizable. If you want the || to work, you have to do the _currentframe matter one at a time:
    code:
    if(_root.men._currentframe==1 || _root.men._currentframe==2 ||...){
    //actions
    }

    But this takes a lot of time. So, you could do this instead:
    code:
    if(_root.men._currentframe < 11){
    //actions
    }



    -edit-
    Doh..I hate it when you type somethin and someone else sneeks one in...oh well. Here is what gparis said.

    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

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