A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Multiple condition checking.

  1. #1
    Junior Member
    Join Date
    Apr 2004
    Location
    Singapore
    Posts
    8

    Multiple condition checking.

    Hi all, am trying to do a multiple if statement checking to determine which frame label within a MC (NE) and is located on frame 3 of the main timeline, to display.

    In the main timeline frame 1, I have declared a new var:

    var n_e;

    button1.onRelease = function (){
    n_e1 = 1;
    main timeline go to and stop at frame 3
    }

    button2.onRelease = function (){
    n_e1 = 2;
    main timeline go to and stop at frame 3
    }

    On Frame 3 where the NE movieclip is, i did a onload event on the clip itself:

    NE.onLoad = function() {
    if (n_e1 == 1) {
    this.gotoAndStop("1");
    }
    if (n_e1 == 2) {
    this.gotoAndStop("2");
    }
    }

    But it doesnt seem to work, and most of the time it lands up on Ne("2") instead...

    Would appreciate any kind suggestions to resolving this. Thanks in advance!

  2. #2
    var x:Number = 1; x /= 0;
    Join Date
    Dec 2004
    Posts
    549
    is it because you defined var n_e instead of var n_e1?
    Z¡µµ¥ D££

    Soup In A Box

  3. #3
    Junior Member
    Join Date
    Apr 2004
    Location
    Singapore
    Posts
    8
    Ahh thx ZD, but that wasnt it.. it was just a typo of mine when I created this thread

    still couldnt get it to work though

  4. #4
    Member
    Join Date
    Aug 2003
    Posts
    70
    I tried to put together the .fla you envisioned(hopefully)...

    I think it would be good practice for you to come up with the non-functional fla where we could take a look.

    Take a look and tell us if this is what you wanted.

    Have fun!
    Attached Files Attached Files

  5. #5
    Junior Member
    Join Date
    Apr 2004
    Location
    Singapore
    Posts
    8
    Thanks Eddie for your reply. Sorry I was dumb enough not to put up a fla where things could be more self explained.

    This is how I structured my AS in a non-functional fla currently would you be able to suggest what could be wrong? Thanks.
    Attached Files Attached Files

  6. #6
    Member
    Join Date
    Aug 2003
    Posts
    70
    Yes, well, basically you've got a path problem. When you put code inside an mc, this works for that mc's timeline. So to access the n_e variable that is located on the _root, you need to go to it by _root.n_e

    I have uploaded the fixed solution.

    Keep also in mind, that once the movie clip has loaded, the onLoad() event will not trigger anymore...

    Also as a side help, instead of declaring a label for each frame called 1, 2, 3 and accessing them by telling the script gotoAndStop("1") you could remove the label names and just tell the script to gotoAndStop(frame_number) ... without the quotes... like: gotoAndStop(2);

    Have fun!
    Attached Files Attached Files
    Learning flash, one frame at a time

  7. #7
    Junior Member
    Join Date
    Apr 2004
    Location
    Singapore
    Posts
    8
    Thanks Eddie, i managed to resolve it ^_^ with ur help on hinting about _root.

    I left out a _root. in the declaration of the variable's value in one of the other MC on the stage... Managed to resolve it. Thanks!

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