Skip to content

Commit f728d21

Browse files
core: Fix getting path of AVM2 DisplayObject loaded by AVM1 code
1 parent bc8d4f5 commit f728d21

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

core/src/display_object.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,9 +1765,6 @@ pub trait TDisplayObject<'gc>:
17651765
/// Returns the dot-syntax path to this display object, e.g. `_level0.foo.clip`
17661766
#[no_dynamic]
17671767
fn path(self) -> WString {
1768-
// FIXME this method doesn't work correclty when this DO is from an
1769-
// AVM2 movie that was loaded into AVM1
1770-
17711768
if let Some(parent) = self.avm1_parent() {
17721769
let mut path = parent.path();
17731770
path.push_byte(b'.');
@@ -1855,14 +1852,14 @@ pub trait TDisplayObject<'gc>:
18551852
/// Retrieve the parent of this display object.
18561853
///
18571854
/// This version of the function implements the concept of parenthood as
1858-
/// seen in AVM1. Notably, it disallows access to the `Stage` and to
1859-
/// non-AVM1 DisplayObjects; for an unfiltered concept of parent,
1860-
/// use the `parent` method.
1855+
/// seen in AVM1. Notably, it disallows access to the `Stage` and to a
1856+
/// `LoaderDisplay`; for an unfiltered concept of parent, use the `parent`
1857+
/// method.
18611858
#[no_dynamic]
18621859
fn avm1_parent(self) -> Option<DisplayObject<'gc>> {
18631860
self.parent()
18641861
.filter(|p| p.as_stage().is_none())
1865-
.filter(|p| !p.movie().is_action_script_3())
1862+
.filter(|p| p.as_loader_display().is_none())
18661863
}
18671864

18681865
/// Retrieve the parent of this display object.
@@ -2868,6 +2865,7 @@ impl<'gc> DisplayObject<'gc> {
28682865
pub fn as_morph_shape for MorphShape;
28692866
pub fn as_video for Video;
28702867
pub fn as_bitmap for Bitmap;
2868+
pub fn as_loader_display for LoaderDisplay;
28712869
}
28722870

28732871
pub fn as_interactive(self) -> Option<InteractiveObject<'gc>> {

0 commit comments

Comments
 (0)