diff --git a/lib/interpreter.ts b/lib/interpreter.ts index 8a89615..b583f3d 100644 --- a/lib/interpreter.ts +++ b/lib/interpreter.ts @@ -293,6 +293,14 @@ function isAVM1MovieClip(obj): boolean { obj instanceof AVM1MovieClip; } +// Removing a movieclip should stop the execution of its actions immediately +function stopIfClipRemoved(ectx: ExecutionContext, clip: AVM1Object | AVM1Function) { + if (isAVM1MovieClip(clip) && clip.isGhost) { + console.log("Stopping actions for ghost clip"); + ectx.isEndOfActions = true; + } +} + function as2GetType(v): string { if (v === null) { return 'null'; @@ -2233,6 +2241,7 @@ function avm1_callableHelper(ectx: ExecutionContext, obj: AVM1Object | AVM1Funct } frame.resetCallee(); + stopIfClipRemoved(ectx, obj); return { result, called }; }