Can't play/stop 1 ball

Community Beginner ,
Jan 30, 2021 Jan 30, 2021

Copy link to clipboard

Copied

Hello everyone.

 

Please help!

Has 2 jumping balls and 2 buttons (one stop and one play).

 

When use both ball - all work (push stop button - both balls stop, play button - both balls moving):

import flash.events.MouseEvent;
function ClickStop(Event:MouseEvent){
  stop();
}
stop_button.addEventListener(MouseEvent.MOUSE_UP, ClickStop);
function ClickPlay(Event:MouseEvent){
  play();
}
play_button.addEventListener(MouseEvent.MOUSE_UP, ClickPlay);

 

But when try to stop/play only one ball by same buttons- it does't work:

import flash.events.MouseEvent;
function ClickStop(Event:MouseEvent){
  RB.stop();
}
stop_button.addEventListener(MouseEvent.MOUSE_UP, ClickStop);
function ClickPlay(Event:MouseEvent){
  RB.play();
}
play_button.addEventListener(MouseEvent.MOUSE_UP, ClickPlay);

RB - is the instance name.

 

Also try a layer name.

But nothing..

Please help!

Views

109

Likes

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

Adobe Community Professional , Jan 30, 2021 Jan 30, 2021
shift click (the first frame and last frame in RB' layer) to select all the frames in RB's animation >right click >click cut frames.  then double click the library symbol for RB to go to its timeline >right click the first frame and click paste. same for the other ball. p.s.  i usually charge for downloading and fixing your fla.  if you still want me to do that send me a private message.

Likes

Translate

Translate
Adobe Community Professional ,
Jan 30, 2021 Jan 30, 2021

Copy link to clipboard

Copied

if the top code snippet ever worked, you would need to change your setup for the bottom code snippet to work.

 

ie, the top code works when there's animation on the timeline that contains that code and if that stops both balls it means both are animated on that timeline.  the bottom code would work if RB were animated on its own timeline, not the timeline that contains that code.

 

solution: copy the animation from the parent timeline and paste into each ball's timeline.

Likes

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 ,
Jan 30, 2021 Jan 30, 2021

Copy link to clipboard

Copied

you are right, both balls are on the same timeline now.
but cound you tell me how I can "copy the animation from the parent timeline and paste into each ball's timeline"?
I tried to open the scene panel and create three scenes each with each timeline, but they are played sequentially (buttons first, then buttons disaapear and jumping green ball appear, then a jumping red ball), but I need everything to be together on the display.
and code still not working.3 scenes.PNG
thank you

Likes

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
Adobe Community Professional ,
Jan 30, 2021 Jan 30, 2021

Copy link to clipboard

Copied

shift click (the first frame and last frame in RB' layer) to select all the frames in RB's animation >right click >click cut frames.  then double click the library symbol for RB to go to its timeline >right click the first frame and click paste.

 

same for the other ball.

 

p.s.  i usually charge for downloading and fixing your fla.  if you still want me to do that send me a private message.

Likes

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 ,
Jan 30, 2021 Jan 30, 2021

Copy link to clipboard

Copied

Thank you SO MUCH, it's working!! 🙂
Also thahks for contact, if I need a deep consultation with .fla, I'll type you.

Likes

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
Adobe Community Professional ,
Jan 30, 2021 Jan 30, 2021

Copy link to clipboard

Copied

LATEST

you're welcome 

Likes

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 ,
Jan 30, 2021 Jan 30, 2021

Copy link to clipboard

Copied

Do you mind if I send you the .fla files from the question by email? I can't attach it to the question or comments.

My email komoneko@mail.ru.

Many thanks!

Likes

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