Skip to main content
Participant
April 4, 2007
Question

Multiple click points for one button and movie clip

  • April 4, 2007
  • 3 replies
  • 308 views
I am trying to make a single button into a multiple click point. I have a movie clip on the stage and I have an invisible button over it. The movie clip consists of a single timeline that has an ambient animation running and looping intially. I have three more labeled sections of that timeline that each contain a different animated sequence as click point animations for that movie clip. I want the user to click on the button on the stage and the first labeled click point animation of that movie clip will play. I want that action to be stored so that when the user clicks again then the second labeled click point animation will play then they will click for the third in the same way. In between user clicks I want the ambient animation loop in the beginning of that movie clip timeline to play. When the user has clicked the 3rd and last animated sequence then the whole thing will reset and be available again. Can anyone let me know how that can be accomplished. I originally scripted it through tell target to play the first but I don't know how to move forward. Thanks!
This topic has been closed for replies.

3 replies

aishaebAuthor
Participant
April 4, 2007
Thank you too much for that quick answer. WOW! I will try it out shortly and get back with you. Really thanks :) Aisha
April 4, 2007
^ you put the first bit of code on frame 1 of the main timeline
April 4, 2007
What version of Flash are you using? Telltarget is very old... try something like this:

// array of the animations
myAnims = ['firstAnim','secondAnim','thirdAnim']; // these are also frame labels
// your current animation index in the array, arrays start at 0,
// so we start at -1 which is like before anything
currAnim = -1;

// function to play the next animation
function nextAnim(){
// add one to the current animation index
currAnim++;
// if you've reached the end of the array, start back at 0
if(currAnim >= myAnims.length)currAnim = 0;
// now tell the MovieClip to play based on the value of the current array index
myMovieClip.gotoAndPlay(myAnims[currAnim]);
}

Then on the button you just put:
on(release){
nextAnim();
}

And at the end of each animation on the timeline, put:
gotoAndPlay(1);

And at the end of the ambient loop at the beginning I guess you have that, too, so it loops.

Hope that helps