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

How do I resume animation on mouse click?

Community Beginner ,
Oct 04, 2015 Oct 04, 2015

Copy link to clipboard

Copied

I created a simple animation of water flowing through pipes and need it to pause at certain points then resume on a mouse click. How do I do that with actionscript 3.0?

TOPICS
ActionScript

Views

848

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

correct answers 1 Correct answer

LEGEND , Oct 04, 2015 Oct 04, 2015

Use the play() command in the event handler...

resumeBtn.addEventListener(MouseEvent.CLICK, resumeAnimation);

function resumeAnimation(evt:MouseEvent):void {

       play();

}

If you do not have a button for this and just want to click anywhere try changing the event listener to...

stage.addEventListener(MouseEvent.CLICK, resumeAnimation);

Votes

Translate

Translate
Community Expert ,
Oct 04, 2015 Oct 04, 2015

Copy link to clipboard

Copied

either place stop() on the water movieclip's timeline where you want that pause or use an enterframe loop to repeatedly check that movieclips currentFrame.

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 ,
Oct 04, 2015 Oct 04, 2015

Copy link to clipboard

Copied

Thank you for that, but then how do I resume with a mouse click?

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
LEGEND ,
Oct 04, 2015 Oct 04, 2015

Copy link to clipboard

Copied

Use the play() command in the event handler...

resumeBtn.addEventListener(MouseEvent.CLICK, resumeAnimation);

function resumeAnimation(evt:MouseEvent):void {

       play();

}

If you do not have a button for this and just want to click anywhere try changing the event listener to...

stage.addEventListener(MouseEvent.CLICK, resumeAnimation);

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 ,
Oct 04, 2015 Oct 04, 2015

Copy link to clipboard

Copied

LATEST

Awesome! Thank you very much! I needed the click anywhere code snippet.

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