diff --git a/core/src/display_object/movie_clip.rs b/core/src/display_object/movie_clip.rs index a36c32e11..7e18b5baf 100644 --- a/core/src/display_object/movie_clip.rs +++ b/core/src/display_object/movie_clip.rs @@ -2650,7 +2650,9 @@ impl<'gc> TDisplayObject<'gc> for MovieClip<'gc> { fn construct_frame(&self, context: &mut UpdateContext<'_, 'gc>) { // AVM1 code expects to execute in line with timeline instructions, so // it's exempted from frame construction. - if self.movie().is_action_script_3() && self.frames_loaded() >= 1 { + if self.movie().is_action_script_3() + && (self.frames_loaded() >= 1 || self.total_frames() == 0) + { let is_load_frame = !self.0.read().initialized(); let needs_construction = if matches!(self.object2(), Avm2Value::Null) { self.allocate_as_avm2_object(context, (*self).into()); diff --git a/tests/tests/swfs/avm2/zero_frame_clip/Main.as b/tests/tests/swfs/avm2/zero_frame_clip/Main.as new file mode 100755 index 000000000..3bc4d77cb --- /dev/null +++ b/tests/tests/swfs/avm2/zero_frame_clip/Main.as @@ -0,0 +1,17 @@ +package { + + import flash.display.MovieClip; + + + + public class Main extends MovieClip { + + + public function Main() { + var child = MovieClip(this.getChildAt(0)); + trace("Child: " + child + " totalFrames: " + child.totalFrames); + child.addChild(new NormalChild()); + } + } + +} diff --git a/tests/tests/swfs/avm2/zero_frame_clip/TraceConstructor.as b/tests/tests/swfs/avm2/zero_frame_clip/TraceConstructor.as new file mode 100755 index 000000000..59a518f74 --- /dev/null +++ b/tests/tests/swfs/avm2/zero_frame_clip/TraceConstructor.as @@ -0,0 +1,14 @@ +package { + + import flash.display.MovieClip; + + + public class TraceConstructor extends MovieClip { + + + public function TraceConstructor() { + trace("Constructed TraceConstructor with name: " + this.name); + } + } + +} diff --git a/tests/tests/swfs/avm2/zero_frame_clip/output.txt b/tests/tests/swfs/avm2/zero_frame_clip/output.txt new file mode 100644 index 000000000..756441432 --- /dev/null +++ b/tests/tests/swfs/avm2/zero_frame_clip/output.txt @@ -0,0 +1,3 @@ +Child: [object ZeroFrames] totalFrames: 0 +Constructed TraceConstructor with name: child1 +Constructed TraceConstructor with name: child2 diff --git a/tests/tests/swfs/avm2/zero_frame_clip/test.fla b/tests/tests/swfs/avm2/zero_frame_clip/test.fla new file mode 100755 index 000000000..bba5ebf58 Binary files /dev/null and b/tests/tests/swfs/avm2/zero_frame_clip/test.fla differ diff --git a/tests/tests/swfs/avm2/zero_frame_clip/test.swf b/tests/tests/swfs/avm2/zero_frame_clip/test.swf new file mode 100644 index 000000000..907dccbea Binary files /dev/null and b/tests/tests/swfs/avm2/zero_frame_clip/test.swf differ diff --git a/tests/tests/swfs/avm2/zero_frame_clip/test.toml b/tests/tests/swfs/avm2/zero_frame_clip/test.toml new file mode 100644 index 000000000..00f2f0181 --- /dev/null +++ b/tests/tests/swfs/avm2/zero_frame_clip/test.toml @@ -0,0 +1,3 @@ +# NOTE - test.swf was manually edited to remove the single (empty) frame, +# so that it actually has zero frames. +num_ticks = 3 \ No newline at end of file