A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [F8] Check if a movieclip has played and if so, go to frame x

  1. #1
    Junior Member
    Join Date
    Jan 2006
    Posts
    23

    [F8] Check if a movieclip has played and if so, go to frame x

    Hi all,

    I have a movieclip activated by a button. I want to be able to check if the movieclip has been played once and if so, skip to the end frame of said movieclip.

    I've set a variable in the main timeline:
    var introPlayed:Boolean = false;

    And then, at the end of the movielip in question:
    introPlayed = true;

    And then on the button which activates the movieclip I've got:
    on(release) {
    _root.main_mc.gotoAndStop("phone");
    gotoAndStop("phone");
    if (introPlayed == true) {
    _root.main_mc.phone_mc.phonesub_mc.gotoAndStop("in troplayed"); //end frame of movieclip
    }
    }

    but it doesn't work!

    Is the fact that my movieclip is rather buried deep, part of the problem?

    Thanks in advance!
    ScareBBear...

  2. #2
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    its because (more or less) you have TWO variables called introPlayed.

    one on the MAIN timeline..and one in the movieClip timeline.

    you can either add _root (or whatever path) to the variable in movieClip (_root.introPlayed = true or better yet..just set it with the button once you have pressed it.

    maybe like this:

    PHP Code:
    button1.onRelease = function() {
        
    _root.main_mc.gotoAndStop("phone");
        
    gotoAndStop("phone");
        if (
    introPlayed == true) {
            
    _root.main_mc.phone_mc.phonesub_mc.gotoAndStop("in troplayed");
            
    //end frame of movieclip
        
    } else {
            
    introPlayed true;
        }
    }; 

  3. #3
    Junior Member
    Join Date
    Jan 2006
    Posts
    23
    Hiya Whispers,

    many thanks for this; it worked a charm!

    Cheers,
    ScareBBear

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