diff --git a/core/src/display_object/movie_clip.rs b/core/src/display_object/movie_clip.rs index 0686bce47..b3be41e19 100644 --- a/core/src/display_object/movie_clip.rs +++ b/core/src/display_object/movie_clip.rs @@ -4439,7 +4439,12 @@ impl QueuedTagList { fn queue_add(&mut self, add_tag: QueuedTag) { let new = match self { QueuedTagList::None => QueuedTagList::Add(add_tag), - QueuedTagList::Add(_) => QueuedTagList::Add(add_tag), + QueuedTagList::Add(existing) => { + // Flash player traces "Warning: Failed to place object at depth 1.", + // so let's log a warning too. + tracing::warn!("Ignoring queued tag {add_tag:?} at same depth as {existing:?}"); + QueuedTagList::Add(*existing) + } QueuedTagList::Remove(r) => QueuedTagList::RemoveThenAdd(*r, add_tag), QueuedTagList::RemoveThenAdd(r, _) => QueuedTagList::RemoveThenAdd(*r, add_tag), }; diff --git a/tests/tests/swfs/avm2/place_object_same_depth_frame/FirstChild.as b/tests/tests/swfs/avm2/place_object_same_depth_frame/FirstChild.as new file mode 100755 index 000000000..d14815f1d --- /dev/null +++ b/tests/tests/swfs/avm2/place_object_same_depth_frame/FirstChild.as @@ -0,0 +1,14 @@ +package { + + import flash.display.MovieClip; + + + public class FirstChild extends MovieClip { + + + public function FirstChild() { + trace("Constructed FirstChild"); + } + } + +} diff --git a/tests/tests/swfs/avm2/place_object_same_depth_frame/SecondChild.as b/tests/tests/swfs/avm2/place_object_same_depth_frame/SecondChild.as new file mode 100755 index 000000000..0370f3b91 --- /dev/null +++ b/tests/tests/swfs/avm2/place_object_same_depth_frame/SecondChild.as @@ -0,0 +1,14 @@ +package { + + import flash.display.MovieClip; + + + public class SecondChild extends MovieClip { + + + public function SecondChild() { + trace("Constructed SecondChild") + } + } + +} diff --git a/tests/tests/swfs/avm2/place_object_same_depth_frame/output.txt b/tests/tests/swfs/avm2/place_object_same_depth_frame/output.txt new file mode 100644 index 000000000..f28642c74 --- /dev/null +++ b/tests/tests/swfs/avm2/place_object_same_depth_frame/output.txt @@ -0,0 +1 @@ +Constructed FirstChild diff --git a/tests/tests/swfs/avm2/place_object_same_depth_frame/test.fla b/tests/tests/swfs/avm2/place_object_same_depth_frame/test.fla new file mode 100755 index 000000000..01dff2f8a Binary files /dev/null and b/tests/tests/swfs/avm2/place_object_same_depth_frame/test.fla differ diff --git a/tests/tests/swfs/avm2/place_object_same_depth_frame/test.swf b/tests/tests/swfs/avm2/place_object_same_depth_frame/test.swf new file mode 100644 index 000000000..1539d0b52 Binary files /dev/null and b/tests/tests/swfs/avm2/place_object_same_depth_frame/test.swf differ diff --git a/tests/tests/swfs/avm2/place_object_same_depth_frame/test.toml b/tests/tests/swfs/avm2/place_object_same_depth_frame/test.toml new file mode 100644 index 000000000..74efcd971 --- /dev/null +++ b/tests/tests/swfs/avm2/place_object_same_depth_frame/test.toml @@ -0,0 +1,3 @@ +# NOTE - test.swf is manually edited to have two PlaceObject tags +# in the same frame with the same depth +num_frames = 1