A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Vars within MC

  1. #1
    Sheep Amidst Wolves azaral's Avatar
    Join Date
    Feb 2001
    Location
    Maryland
    Posts
    162

    Vars within MC

    I have 4 instances of the same MC on my stage (check1 - check4). In frame 1 of this MC i have the following:
    stop();
    check == 0;

    and a button that (when clicked) goes to the "cmark" frame where check == 1;. Also in "cmark" there's a hotspot button to take the user back to frame 1.

    So, on my stage, i have a Check Answer button that needs scripting. As mentioned, there's 4 MCs that the user can check/uncheck. Now, I need a script that says something like this:
    on (press) {
    if(check1.check == 1 && check2.check == 0 && check3.check == 0 && check4.check == 0){
    gotoAndStop("correct");
    } else {
    gotoAndStop("incorrect");
    }
    }


    I know this is wrong (because it doesn't work) so please advise me on how to get this right. I'm thinking I need a script inside the MC to customize the check variable? TIA my flash brethren.
    azaral aviv
    "Study to shew thyself approved unto God, a workman that needeth not to be ashamed, rightly dividing the word of truth." - II Timothy 2:15

  2. #2
    Senior Member
    Join Date
    Apr 2001
    Posts
    249
    Where is your gotoAndStop("correct") supposed to go to? Your code is checking that all 4 possiblities are true. Can you trace the values of each from your check Answer button. Maybe the values aren't getting passed.

  3. #3
    Sheep Amidst Wolves azaral's Avatar
    Join Date
    Feb 2001
    Location
    Maryland
    Posts
    162
    thanks for your response, navarone. when the user clicks the Check Answer button, the script should verify that the "check" variable in check1 = 1 and the check values in check2-4 = 0. If this is true, then the user will go to "correct" on the main timeline. If it is incorrect, the user will go to "incorrect" on the main timeline.

    thanks again.
    azaral aviv
    "Study to shew thyself approved unto God, a workman that needeth not to be ashamed, rightly dividing the word of truth." - II Timothy 2:15

  4. #4
    Senior Member
    Join Date
    Apr 2001
    Posts
    249
    Did you try:

    _root.gotoAndStop("correct");

  5. #5
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Hi
    Also.....
    In frame 1 of each movieclip....it should be......
    code:

    stop();
    check = 0;


    and in "cmark" frame it should also be....
    code:

    stop();
    check = 1;


    think of it like this.....
    (== ....."has come to equal".......)
    ( = ..... "make equal"........
    Last edited by hum; 06-30-2005 at 09:04 PM.

  6. #6
    Sheep Amidst Wolves azaral's Avatar
    Join Date
    Feb 2001
    Location
    Maryland
    Posts
    162
    thx for your respones, Nav & Hum. however, my issue is not with variable(s) or the goto action. I'm kinda stumped on the script for calculating the 'check' variables in each MC.

    See, the MC (CheckMark) has the check variables going from 0 or 1. On my stage, I have 4 instances of the CheckMark MC (check1 - check4). My 'Check Answer' button on the stage needs to calculate the 'check' var from each MC. Am I to put a script ON each MC like:
    onClipEvent(enterFrame)
    mark1 = this.check;
    }

    to get the check value from each MC and THEN calculate mark1 - mark4 with something like:
    on (press) {
    if(mark1 == 1 && mark2 == 0 && mark3 == 0 && mark4 == 0 ){
    gotoAndStop("correct");
    } else {
    gotoAndStop("incorrect");
    }
    }


    Please advise.
    azaral aviv
    "Study to shew thyself approved unto God, a workman that needeth not to be ashamed, rightly dividing the word of truth." - II Timothy 2:15

  7. #7
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Hi
    I see what you are trying to do....
    If you post your .fla or a basic example of your fla i will take a look for you....

  8. #8
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Hi again....
    I made this so you will understand.........

  9. #9
    Sheep Amidst Wolves azaral's Avatar
    Join Date
    Feb 2001
    Location
    Maryland
    Posts
    162
    that is exactly what i was looking for. it seems i had it all along except i was missing the "_root." on my MCs when identifying the "mark"s. thank you so much, brother HUM!
    azaral aviv
    "Study to shew thyself approved unto God, a workman that needeth not to be ashamed, rightly dividing the word of truth." - II Timothy 2:15

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