Skip to main content
Participant
October 30, 2021
Answered

simple play button

  • October 30, 2021
  • 1 reply
  • 402 views

Hi.  I have an animated story for children.  I simply want the animation to stop at different points and continue when I click a play button.   I've placed stop actions on the main timeline stop(); and I have a play button (instance name PlayButton)with the script below that works fine

//Play Function
function ClickPlay(Event:MouseEvent){
play();
}

//Call Play Button
PlayButton.addEventListener(MouseEvent.MOUSE_UP, ClickPlay);

 

However a problem occurs at scene 2.  I assumed I could simply use the same button and script but it doesn't work.  Do I need to make a new button with a different script for different scenes?

I know this is very basic but it's driving me mad 

    This topic has been closed for replies.
    Correct answer kglad

    no, but you need to (re)assign an instance name/listener to your button because the first frame of a new scene is like an empty keyframe.  it doesn't include any objects from the previous scene(s).

    1 reply

    kglad
    Community Expert
    kgladCommunity ExpertCorrect answer
    Community Expert
    November 1, 2021

    no, but you need to (re)assign an instance name/listener to your button because the first frame of a new scene is like an empty keyframe.  it doesn't include any objects from the previous scene(s).

    Participant
    November 9, 2021

    Thank you

    kglad
    Community Expert
    Community Expert
    November 9, 2021

    you're welcome.