We're also checking for the depth now when searching for displayobjects
This commit is contained in:
parent
aaede767fe
commit
90cb88d50e
|
@ -1284,8 +1284,7 @@ impl Player {
|
||||||
if let Some(root_clip) = context.stage.root_clip() {
|
if let Some(root_clip) = context.stage.root_clip() {
|
||||||
display_object = Self::find_first_character_instance(
|
display_object = Self::find_first_character_instance(
|
||||||
root_clip,
|
root_clip,
|
||||||
&down_object.as_displayobject().id(),
|
down_object.as_displayobject(),
|
||||||
&down_object.as_displayobject().movie(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1502,17 +1501,19 @@ impl Player {
|
||||||
//TODO: is there a better place to place next two functions?
|
//TODO: is there a better place to place next two functions?
|
||||||
fn find_first_character_instance<'gc>(
|
fn find_first_character_instance<'gc>(
|
||||||
obj: DisplayObject<'gc>,
|
obj: DisplayObject<'gc>,
|
||||||
character_id: &CharacterId,
|
previous_object: DisplayObject<'gc>,
|
||||||
needed_movie: &Arc<SwfMovie>,
|
|
||||||
) -> Option<DisplayObject<'gc>> {
|
) -> Option<DisplayObject<'gc>> {
|
||||||
if let Some(parent) = obj.as_container() {
|
if let Some(parent) = obj.as_container() {
|
||||||
|
let character_id = previous_object.id();
|
||||||
for child in parent.iter_render_list() {
|
for child in parent.iter_render_list() {
|
||||||
if &child.id() == character_id && Arc::ptr_eq(&child.movie(), needed_movie) {
|
if child.id() == character_id
|
||||||
|
&& child.depth() == previous_object.depth()
|
||||||
|
&& Arc::ptr_eq(&child.movie(), &previous_object.movie())
|
||||||
|
{
|
||||||
return Some(child);
|
return Some(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
let display_object =
|
let display_object = Self::find_first_character_instance(child, previous_object);
|
||||||
Self::find_first_character_instance(child, character_id, needed_movie);
|
|
||||||
if display_object.is_some() {
|
if display_object.is_some() {
|
||||||
return display_object;
|
return display_object;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue