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

PlayPause song in the same button in adobe animate?

Contributor ,
Mar 15, 2024 Mar 15, 2024

Copy link to clipboard

Copied

hello there 

i want to make a play/pause button

the same button for two functions

i am using this code...

 

import flash.events.MouseEvent;

stop();

start_button.addEventListener (MouseEvent.CLICK, onClick);

function onClick(event:MouseEvent):void

{

nextFrame(); // if you want to go to frame 2 and stop

play(); // if you want to go to frame 2 and play

}

 

it works for playing but not for pausing........

whats the action script for playpause in the same button?

anybody help me

 

Views

84

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

Community Expert , Mar 15, 2024 Mar 15, 2024

import flash.events.MouseEvent;

stop();

var toggle:Boolean

start_button.addEventListener (MouseEvent.CLICK, onClick);

function onClick(event:MouseEvent):void

{

if(toggle){

nextFrame(); // if you want to go to nextframe and stop

} else {

play(); // if you want to go to nextframe and play

}

toggle=!toggle;  // or place this as first line of onClick, if you want to change how the button starts

}

Votes

Translate

Translate
Community Expert ,
Mar 15, 2024 Mar 15, 2024

Copy link to clipboard

Copied

import flash.events.MouseEvent;

stop();

var toggle:Boolean

start_button.addEventListener (MouseEvent.CLICK, onClick);

function onClick(event:MouseEvent):void

{

if(toggle){

nextFrame(); // if you want to go to nextframe and stop

} else {

play(); // if you want to go to nextframe and play

}

toggle=!toggle;  // or place this as first line of onClick, if you want to change how the button starts

}

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
Contributor ,
Mar 15, 2024 Mar 15, 2024

Copy link to clipboard

Copied

hello man it worked

thank you a lot

i ll mark as correct

finished this issue

i post another issue separate

in order to maintain your answer

 

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 ,
Mar 15, 2024 Mar 15, 2024

Copy link to clipboard

Copied

LATEST

good to hear!

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