• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Need help - Basic buttons to control animation/movieclips

Community Beginner ,
Aug 25, 2023 Aug 25, 2023

Copy link to clipboard

Copied

I am trying to make some basic buttons to control animation/timelines.

All I need is a play button, pause button and replay button.

I would like all the code to be on the first frame of the main timeline. So far this is all I have...

this.stop();
this.ani.stop();

this.playBtn.addEventListener("click", fl_MouseClickHandler.bind(this));

function fl_MouseClickHandler() {
	this.ani.play();
}

The names of the objects are...

  • animation = ani
  • play button = playBtn
  • pause button = pauseBtn
  • replay button = replayBtn

I have the file setup as such...

  • layer 1 = code
  • layer 2 = buttons
  • layer 3 = animation

All the animation is in one movie clip that is on the third layer. If possible I would like to tell the animation to stop playing from the root timeline, when it gets to the last frame, not by putting a stop in the movie clip of the animation. I want to control everything from the code in the root timeline if possible.

 

Any help would be much appreciated. 😃

ps... I tried to upload my .fla but everytime I try to post I get an error saying my file's content doesn't match its extention.

TOPICS
Code , Timeline

Views

92

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 25, 2023 Aug 25, 2023

Copy link to clipboard

Copied

does your code work to play what you want?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 25, 2023 Aug 25, 2023

Copy link to clipboard

Copied

Right now clicking the play button will play the targeted movie clip.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 25, 2023 Aug 25, 2023

Copy link to clipboard

Copied

LATEST

pause:

 

 

this.pauseBtn.addEventListener("click", pauseF.bind(this));

function pauseF() {
	this.ani.stop();
}

 

 

replay:

this.replayBtn.addEventListener("click", replayF.bind(this));

function replayF() {
	this.ani.gotoAndPlay(0);
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines