core: Assign `rootN` format names to top-level AVM2 movie clips.
This commit is contained in:
parent
19f9e99954
commit
6080585d73
|
@ -2776,6 +2776,7 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> {
|
||||||
.into();
|
.into();
|
||||||
|
|
||||||
level.set_depth(self.context.gc_context, level_id as i32);
|
level.set_depth(self.context.gc_context, level_id as i32);
|
||||||
|
level.set_default_root_name(&mut self.context);
|
||||||
self.context.levels.insert(level_id, level);
|
self.context.levels.insert(level_id, level);
|
||||||
level.post_instantiation(&mut self.context, level, None, Instantiator::Movie, false);
|
level.post_instantiation(&mut self.context, level, None, Instantiator::Movie, false);
|
||||||
|
|
||||||
|
|
|
@ -949,6 +949,18 @@ pub trait TDisplayObject<'gc>:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Assigns a default root name to this object.
|
||||||
|
///
|
||||||
|
/// The default root names change based on the AVM configuration of the
|
||||||
|
/// clip; AVM2 clips get `rootN` while AVM1 clips get blank strings.
|
||||||
|
fn set_default_root_name(&self, context: &mut UpdateContext<'_, 'gc, '_>) {
|
||||||
|
if !matches!(self.object2(), Avm2Value::Undefined) {
|
||||||
|
self.set_name(context.gc_context, &format!("root{}", self.depth() + 1));
|
||||||
|
} else if !matches!(self.object(), Avm1Value::Undefined) {
|
||||||
|
self.set_name(context.gc_context, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn bind_text_field_variables(&self, activation: &mut Activation<'_, 'gc, '_>) {
|
fn bind_text_field_variables(&self, activation: &mut Activation<'_, 'gc, '_>) {
|
||||||
// Check all unbound text fields to see if they apply to this object.
|
// Check all unbound text fields to see if they apply to this object.
|
||||||
// TODO: Replace with `Vec::drain_filter` when stable.
|
// TODO: Replace with `Vec::drain_filter` when stable.
|
||||||
|
|
|
@ -377,7 +377,7 @@ impl Player {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
root.post_instantiation(context, root, flashvars, Instantiator::Movie, false);
|
root.post_instantiation(context, root, flashvars, Instantiator::Movie, false);
|
||||||
root.set_name(context.gc_context, "");
|
root.set_default_root_name(context);
|
||||||
context.levels.insert(0, root);
|
context.levels.insert(0, root);
|
||||||
|
|
||||||
// Load and parse the device font.
|
// Load and parse the device font.
|
||||||
|
|
Loading…
Reference in New Issue