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

stop(); doesn't work

Explorer ,
Aug 30, 2016 Aug 30, 2016

Ok, I've seen this posted several times but all not quite what I'm asking. I have just created a new project and wanted to just test the most basic commands. I have a script in an Actions layer that says "stop();" without the quotes obviously. It doesn't stop the playhead. It stops it at the end but not at frame 2 where the script is.

I just asked on Chat and was sent here because it was "code related!".

I've seen comments about this.stop() but this is not HTML canvas. I'm publishing as AIR for desktop at the moment to test and it does stop at the right place in published file, just not when I hit Enter in Animate itself.

Any ideas?

TOPICS
ActionScript
828
Translate
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 , Aug 30, 2016 Aug 30, 2016

You say it happens when you hit Enter... and you see the playhead moving along the timeline.  That is just going to play thru the timeline, it is not processing code when you do that.  Try hitting CTRL-Enter instead.  That will publish/play the output file and should stop at the frame intended.

Translate
LEGEND ,
Aug 30, 2016 Aug 30, 2016

Is there any other code in the file?

Translate
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
Explorer ,
Aug 30, 2016 Aug 30, 2016

No, literally just that line in a layer called Actions (it labelled it that automatically).

Translate
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 ,
Aug 30, 2016 Aug 30, 2016

What else is in the file that makes you say it reaches the end before it stops?

The stop() command is a timeline command, so if you were to have a movieclip in the same frame as the stop command in the main timeline, the main timeline would stop at that frame, but the movieclip would play itself out.  If the intent was to stop the movieclip then your command would either have to be inside the movieclip or the code in the main timeline would have to target the movieclip by its instance name with a stop() command [ eg: mcName.stop(); ]

Translate
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
Explorer ,
Aug 30, 2016 Aug 30, 2016

I have 2 images in the timeline. The second image starts at frame 5. The AS stop(); is in frame 4. When I Debug, it plays by showing the first, then the second image and loops, switching back and forth. When I play in Animate the play head just plays along to the end of the timeline. It never stops.

test-screen.jpg

Translate
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 ,
Aug 30, 2016 Aug 30, 2016

You say it happens when you hit Enter... and you see the playhead moving along the timeline.  That is just going to play thru the timeline, it is not processing code when you do that.  Try hitting CTRL-Enter instead.  That will publish/play the output file and should stop at the frame intended.

Translate
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
Explorer ,
Aug 30, 2016 Aug 30, 2016

Ok, that's useful to know thank you. It was also doing the same thing in Debug playback (Shift CTRL Enter). I have however "fixed" that issue through a change that should have made no difference - I swapped the two images around so image2 appears first. There is no other code in the project so this seems completely nonsensical to me. I think there's a bug floating around...

Translate
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 ,
Aug 30, 2016 Aug 30, 2016
LATEST

If you are seeing the timeline playhead moving you are looking at the wrong animal.

Translate
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