avm2: Don't except when creating a dynamic TextField.
This commit is contained in:
parent
4ef01000a8
commit
78c519cce0
|
@ -27,17 +27,13 @@ pub fn instance_init<'gc>(
|
|||
|
||||
if this.as_display_object().is_none() {
|
||||
let movie = Arc::new(SwfMovie::empty(activation.context.swf.version()));
|
||||
let new_do = EditText::new(
|
||||
&mut activation.context,
|
||||
movie.clone(),
|
||||
0.0,
|
||||
0.0,
|
||||
100.0,
|
||||
100.0,
|
||||
);
|
||||
let movie_library = activation
|
||||
.context
|
||||
.library
|
||||
.library_for_movie_mut(movie.clone());
|
||||
movie_library.force_avm_type(AvmType::Avm2);
|
||||
|
||||
let movie_library = activation.context.library.library_for_movie_mut(movie);
|
||||
movie_library.check_avm_type(AvmType::Avm2).unwrap();
|
||||
let new_do = EditText::new(&mut activation.context, movie, 0.0, 0.0, 100.0, 100.0);
|
||||
|
||||
this.init_display_object(activation.context.gc_context, new_do.into());
|
||||
}
|
||||
|
|
|
@ -263,6 +263,15 @@ impl<'gc> MovieLibrary<'gc> {
|
|||
self.avm_type
|
||||
}
|
||||
|
||||
/// Forcibly set the AVM type of this movie.
|
||||
///
|
||||
/// This is intended for display object types which can be created
|
||||
/// dynamically but need a placeholder movie. You should *not* attempt to
|
||||
/// change the AVM type of an actual SWF.
|
||||
pub fn force_avm_type(&mut self, new_type: AvmType) {
|
||||
self.avm_type = new_type;
|
||||
}
|
||||
|
||||
pub fn set_avm2_domain(&mut self, avm2_domain: Avm2Domain<'gc>) {
|
||||
self.avm2_domain = Some(avm2_domain);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue