A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: [F8] controlling keyframes within movie clips?

  1. #1
    Member
    Join Date
    May 2007
    Posts
    80

    [F8] controlling keyframes within movie clips?

    i have 3 buttons on my stage that i want when pressed to goto different keyframes in a movieclip i made, is this possible?

    also is there a way i can place a button within a movie clip and then drag the movie clip to the stage and make the buttons work with the timeline from within the movie clip? hope that makes sense!

    pls help! x

  2. #2
    Junior Member
    Join Date
    Feb 2007
    Posts
    14
    to answer your first question, you can either name the frames you want to go to, using the property inspector, or reference them by their frame numbers.

    Either way you are going to use gotoAndPlay().

    Code:
    myButton.onRelease = function(){
       myMovieClip.gotoAndPlay("frameName");
    }

  3. #3
    Junior Member
    Join Date
    Feb 2007
    Posts
    14
    for your second question, I think you are talking about scope. You can have pretty much any movieClip (or buttons) perform actions on other movieClips using the proper address. for instance if I have 2 movieclips and a button on the _root timeline, I can control either movieclip by setting up the function on the button:

    Code:
    myButton.onRelease = function(){
        myMovieClip1.play();
    }
    
    or
    
    myButton.onRelease = function(){
        myMovieClip2.play();
    }

  4. #4
    Member
    Join Date
    May 2007
    Posts
    80
    cooool! thank you so much for your help colbydev x

  5. #5
    Member
    Join Date
    May 2007
    Posts
    80
    not working i get this error with both methods

    "**Error** Scene=web, layer=print, frame=1:Line 1: Statement must appear within on handler
    myButton.onRelease = function(){"

    can someone help me out, please x

  6. #6
    Member
    Join Date
    May 2007
    Posts
    80
    woops! i was putting the code onto the button itself and not into the timeline lol think its working ok now x

  7. #7
    Member
    Join Date
    May 2007
    Posts
    80
    Quote Originally Posted by colbydev
    for your second question, I think you are talking about scope. You can have pretty much any movieClip (or buttons) perform actions on other movieClips using the proper address. for instance if I have 2 movieclips and a button on the _root timeline, I can control either movieclip by setting up the function on the button:

    Code:
    myButton.onRelease = function(){
        myMovieClip1.play();
    }
    
    or
    
    myButton.onRelease = function(){
        myMovieClip2.play();
    }
    the first 1 works great thank you, but the on the 2nd 1 i need to control the main timeline from buttons within a movieclip, ive tried with some other actionscript code...

    on (press){
    _root.gotoAndStop(31);
    }
    but instead of playing the timeline in the external swf file all this is in on my 2nd scene , it goes straight to the root timeline in the 1st scene? lol i think that makes sense well to me anyway heh

    so i need the button within the movieclip to play the timeline on the external swf on my 2nd scene! can anyone help with this?
    sorry i can't put this in more simple terms! thank you x

  8. #8
    Junior Member
    Join Date
    Feb 2007
    Posts
    14
    gotoAndPlay() and gotoAndStop() have an optional parameter for scene, i.e. gotoAndPlay(scene, frame);

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