A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: If and vars on time line ,help! MX

  1. #1
    Member
    Join Date
    Jan 2004
    Posts
    87

    If and vars on time line ,help! MX

    Hi there
    i'm new in action script but i'm trying to make a menu by my self, and i manage to do a part but i'm stuck.
    Here is my problem maybe some one can help me:
    i have 2 bt in a mc(option_mc) and 3 global variables on the stage.
    here is the vars in first frame on _root
    code:

    _global.test = 1;
    _global.bt1_var = 1;
    _global.bt2_var = 1;


    the script for the first button when the second one is open
    code:

    on (release) {
    test = 2;
    bt2_var = 1;
    _root.option_mc.onEnterFrame = function() {
    _root.option_mc.prevFrame();
    if (_root.option_mc._currentframe == 25) {
    delete _root.option_mc.onEnterFrame;
    }
    };
    }


    that plays the movie back to the frame 25 and make var test = 2
    ----------
    on the second button i have this script
    code:

    on (release) {
    bt2_var = 1;
    _root.option_mc.onEnterFrame = function() {
    _root.option_mc.prevFrame();
    if (_root.option_mc._currentframe == 25) {
    delete _root.option_mc.onEnterFrame;
    }
    };
    }


    that dosent have test = 2; so the test var should remain = 1

    ----------
    in the option_mc , on frame 25 i have this action script
    code:

    if (test = 2) {
    gotoAndPlay(2);
    }


    that opes the bt one

    My problem is that if i press the second bt after its open,the movie it's playing back but when is on frem 25 the "IF" script is executed no matter what is the condition, and the condition is "test = 2"

    Here is a link to my menu
    my menu
    press 2 time the second button

    Please excuse my english

    Thank you for your time

  2. #2
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    An if statement takes 2 "==" not only 1...
    code:

    if (test == 2) {
    gotoAndPlay(2);
    }


  3. #3
    Member
    Join Date
    Jan 2004
    Posts
    87
    What could i say?
    Thanks again.

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