avm1: Return proper root object for Avm1::root_object

Was returning start_clip instead. Also call
DisplayObject::post_instantiation for root after it's created in
Player::new.
This commit is contained in:
Mike Welsh 2019-10-07 01:36:05 -07:00
parent 4477e8458f
commit 574ede0541
2 changed files with 8 additions and 1 deletions

View File

@ -986,7 +986,7 @@ impl<'gc> Avm1<'gc> {
/// Obtain the value of `_root`.
pub fn root_object(&self, context: &mut ActionContext<'_, 'gc, '_>) -> Value<'gc> {
context.start_clip.read().object()
context.root.read().object()
}
/// Obtain the value of `_global`.

View File

@ -127,6 +127,13 @@ impl<Audio: AudioBackend, Renderer: RenderBackend, Navigator: NavigatorBackend>
is_mouse_down: false,
};
player.gc_arena.mutate(|gc_context, gc_root| {
gc_root
.root
.write(gc_context)
.post_instantiation(gc_context, gc_root.root)
});
player.build_matrices();
player.preload();