From c20b7b37fed29204b53556dda7fad4f54fbd9220 Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Mon, 14 Aug 2023 19:19:32 -0400 Subject: [PATCH] Adjust behavior --- core/src/frame_lifecycle.rs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/core/src/frame_lifecycle.rs b/core/src/frame_lifecycle.rs index 8413e704d3ec..600997e1d7a7 100644 --- a/core/src/frame_lifecycle.rs +++ b/core/src/frame_lifecycle.rs @@ -121,22 +121,24 @@ pub fn run_inner_goto_frame<'gc>( initial_clip: MovieClip<'gc>, ) { if initial_clip.swf_version() <= 9 { - // This is a hack to make sure that we we run `construct_frame` - // and `frame_constructed` for the frame targeted by our goto. - // It's good enough to get several SWFs working, but we need to - // do a deeper refactor of framescript execution in order for this - // to be correct. - if initial_clip.playing() { - initial_clip - .base_mut(context.gc_context) - .set_skip_next_enter_frame(true); - } avm2_stub_method_context!( context, "flash.display.MovieClip", "goto", "with SWF 9 movie" ); + // Note - this runs `construct_frame` at the wrong time - testing shows that + // clips in the target frame get constructed at some point *after* the + // call to `gotoAndStop/gotoAndPlay` returns. However, I suspect that this is related + // to the very odd framescript behavior in SWF 9 gotos (the *same* framescript can run twice + // in a row). For now, this is enough to get several games working. + initial_clip.construct_frame(context); + // We skip the next `enter_frame` call, so that we will still run the framescripts + // queued for our target frame. + initial_clip + .base_mut(context.gc_context) + .set_skip_next_enter_frame(true); + return; }