A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: Path to frame 2 in MovieClip

  1. #1
    Member
    Join Date
    Mar 2006
    Posts
    61

    Path to frame 2 in MovieClip

    I have this code on a button. Why wont it start on frame 2 of the movieclip I have on the frame labelled "movie2".
    It starts playing at frame 1 no matter what digit I set it to.


    on (keyPress "2") {

    _root.gotoAndPlay("movie2", 2);

    }

  2. #2
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Hi
    Try....
    code:
    on(keyPress"2"){
    _root.movie2.gotoAndPlay(2)
    }


  3. #3
    Member
    Join Date
    Mar 2006
    Posts
    61
    Thanks for trying Hum, but it dosent work.

    Anyone to help me? I think it must be possible to go to a frame and play frame 2 of a MovieClip.

  4. #4
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Hi
    If you post or email a basic of your FLA i will take a look if you like

  5. #5
    Member
    Join Date
    Mar 2006
    Posts
    61

    Here is a little movie with the problem

    I have attached a little movie.

    I want to go to a frame called "movie2" - and start playing the movieclip there from frame 2.
    Attached Files Attached Files

  6. #6
    Senior Member
    Join Date
    May 2002
    Posts
    1,017
    To trigger a movie on a certain frame you should firsty go to that frame, because that movie doesnt exists on the first fram where the button is .

    So the code of the button looks like this

    PHP Code:
    on(release){
    _root.gotoAndStop("movie2"); // first go that frame where movie2 movieclip is 
    _root.movie2.gotoAndPlay(2); // trigger the movie movie2 .. better rename either the movie or the frame label to avoid confusion since both are movie2

    Here is the fla too.

    Err, made a little mistake, so I edited the post
    Attached Files Attached Files
    Last edited by Smilev; 06-14-2006 at 04:21 AM.
    while (2+2 == 4) {
    drink ("bourbon");
    }
    gotoAndStop("bed");

  7. #7
    Member
    Join Date
    Mar 2006
    Posts
    61
    Thanks a whole lot Smiley.

    This is some problem I have headeachs and pain trying to solve. You just made my day - make that week. - No No - damn - make it month.

  8. #8
    Senior Member
    Join Date
    May 2002
    Posts
    1,017
    while (2+2 == 4) {
    drink ("bourbon");
    }
    gotoAndStop("bed");

  9. #9
    Member
    Join Date
    Mar 2006
    Posts
    61

    Still have problems if stop in first frame

    Well your file worked perfectly, but I needed a Stop action in first frame of the movieClip. When I set the Stop action in first frame the result is that it plays only the first frame and quit the movieclip. Very strange.

    Anyone to help solving that problem?

    Look a the new attached file where I have a "stop" in first frame of movieclip.

    The reason that I want to go to frame 2 is to avoid frame one with the stop action. This is because i use the movieclips another place in my movie where the Stop action is needed. But this has nothing to do with the problem asked here.
    Attached Files Attached Files

  10. #10
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Hi
    Can you explain in more detail....?

    Let's look at the code you have on the button..
    code:
    on (release) {
    _root.gotoAndPlay("movie2");
    _root.blueklat.gotoAndPlay(2);
    }



    First you are telling the timeline to go to the frame labelled "movie2",
    Then you are telling something called "bluklat" to go to and play frame 2.

    Is bluklat a movieclip?....or another labelled frame....?

  11. #11
    Member
    Join Date
    Mar 2006
    Posts
    61
    Hello hum !

    Thanks for wanting to help. blueklat is a movieclip.

    You are right. First I am telling the timeline to go to frame labelled "movie2" - Then when playhead is at "movie2" - I am telling to play frame 2 of the movieclip blueklat.

    See attached movie in my last post.

  12. #12
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Hi
    Well as long as you have given the movieclip an instance name of bluklat then the code above should do it though it would be better to see your FLA....can you post or email it?

  13. #13
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Also....maybe this on the timeline...make sure the actions have their own layer and the button is named....btn.
    code:
    stop();
    playBluklat = false;
    btn.onRelease = function() {
    _root.gotoAndPlay("movie2");
    playBluklat = true;
    playBluklatFunction();
    };
    playBluklatFunction = function () {
    onEnterFrame = function () {
    if (playBluklat == true) {
    bluklat.gotoAndPlay(2);
    delete onEnterFrame;
    }
    };
    };

    Last edited by hum; 06-19-2006 at 06:29 PM.

  14. #14
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Hi
    Like this?
    Attached Files Attached Files

  15. #15
    Member
    Join Date
    Mar 2006
    Posts
    61
    Great Hum !

    Now its working. Thank you very much. I am surprised at the amount of code Flash 8 acuires to make such a simple thing.

    I have a few small games i want to have made - are you open for such jobs.
    If you are then look after game description and my Signature in Freelanceres in this Forum.

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