0

I'm new to ActionScript.

I have a scene with a timeline, and inside the scene, I have a symbol with its own timeline started animation at frame 10. I want the scene to stop when the symbol animation hits frame 60.

I can use a scene action script to stop at frame 70. My question is there any way to stop the scene from symbol Actionscript. (use scene object from symbol)

I tried to add this.stop(); in symbol definition but this didn't work.

enter image description here

Youssef Maouche
  • 175
  • 1
  • 2
  • 10
  • You can use the **parent** property of a **MovieClip** to address its container (presumable the upper timeline). You should also typecast the **parent** because compiler does not know it is also a **MovieClip**, only you do. Like this: **(parent as MovieClip).stop();** Documentation: https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObject.html#parent – Organis Jun 05 '21 at 15:47
  • Thanks, for your quick reply. Unfortunately didn't work. I tried also ``MovieClip(this.parent).stop()``<; – Youssef Maouche Jun 05 '21 at 16:29
  • It should work. If it did not, that means the structure of your project is somehow different from what you explain. You can start with learning what display list is and what is its structure: https://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e26.html – Organis Jun 05 '21 at 16:49
  • @Organis IIRC scenes in Flash are separate objects from main timeline, so I'd start with dumping the complete object tree, or at least from target MC up to `this.stage`, then searching the one with the timeline by checking their types with `getQualifiedClassName()`. – Vesper Jun 07 '21 at 15:01
  • @YoussefMaouche you know, your MC might even not exist at frame #70 of your scene's timeline, or go out of sync with it, say if you slam a `stop()` somewhere before frame 70, the MC in question should still be animated. I say better use `Sprite`s with a single-frame main stage, this would put you in full control position over any and every animation that happens on your stage. – Vesper Jun 07 '21 at 15:03
  • @Vesper No. Scenes are in fact just one long main timeline, they exist for the sake of animators who work with long animations. Like, you have **Scene 1** with 100 frames and **Scene 2** with 100 frames, once you command the main timeline to **gotoAndStop(150);** — boom, you're exactly at the middle of the **Scene 2** even if you did that while you logically are on **Scene 1**. – Organis Jun 07 '21 at 19:31

0 Answers0