Correctly handle zero-frame MovieClip
A MovieClip with zero frames can still have a child added through ActionScript, which ticks normally.
This commit is contained in:
parent
f8219a06e0
commit
6c2e28a08f
|
@ -2650,7 +2650,9 @@ impl<'gc> TDisplayObject<'gc> for MovieClip<'gc> {
|
||||||
fn construct_frame(&self, context: &mut UpdateContext<'_, 'gc>) {
|
fn construct_frame(&self, context: &mut UpdateContext<'_, 'gc>) {
|
||||||
// AVM1 code expects to execute in line with timeline instructions, so
|
// AVM1 code expects to execute in line with timeline instructions, so
|
||||||
// it's exempted from frame construction.
|
// it's exempted from frame construction.
|
||||||
if self.movie().is_action_script_3() && self.frames_loaded() >= 1 {
|
if self.movie().is_action_script_3()
|
||||||
|
&& (self.frames_loaded() >= 1 || self.total_frames() == 0)
|
||||||
|
{
|
||||||
let is_load_frame = !self.0.read().initialized();
|
let is_load_frame = !self.0.read().initialized();
|
||||||
let needs_construction = if matches!(self.object2(), Avm2Value::Null) {
|
let needs_construction = if matches!(self.object2(), Avm2Value::Null) {
|
||||||
self.allocate_as_avm2_object(context, (*self).into());
|
self.allocate_as_avm2_object(context, (*self).into());
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package {
|
||||||
|
|
||||||
|
import flash.display.MovieClip;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class Main extends MovieClip {
|
||||||
|
|
||||||
|
|
||||||
|
public function Main() {
|
||||||
|
var child = MovieClip(this.getChildAt(0));
|
||||||
|
trace("Child: " + child + " totalFrames: " + child.totalFrames);
|
||||||
|
child.addChild(new NormalChild());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package {
|
||||||
|
|
||||||
|
import flash.display.MovieClip;
|
||||||
|
|
||||||
|
|
||||||
|
public class TraceConstructor extends MovieClip {
|
||||||
|
|
||||||
|
|
||||||
|
public function TraceConstructor() {
|
||||||
|
trace("Constructed TraceConstructor with name: " + this.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
Child: [object ZeroFrames] totalFrames: 0
|
||||||
|
Constructed TraceConstructor with name: child1
|
||||||
|
Constructed TraceConstructor with name: child2
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,3 @@
|
||||||
|
# NOTE - test.swf was manually edited to remove the single (empty) frame,
|
||||||
|
# so that it actually has zero frames.
|
||||||
|
num_ticks = 3
|
Loading…
Reference in New Issue