Skip to content

Commit 9774a8b

Browse files
tests: Add avm2 test for looking up most kinds of placed DisplayObjects
`Bitmap` has some abnormal place/construct behavior in FP that we don't correctly reproduce, so it's not included in this test
1 parent 9fb018c commit 9774a8b

File tree

7 files changed

+123
-0
lines changed

7 files changed

+123
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package {
2+
import flash.display.*;
3+
import flash.media.Video;
4+
5+
public class Test extends MovieClip {
6+
public var placedShape:DisplayObject;
7+
8+
public var placedMorph:DisplayObject;
9+
10+
public var placedSprite:DisplayObject;
11+
12+
public var placedVideo:DisplayObject;
13+
14+
public var placedButton:DisplayObject;
15+
16+
public var placedText:DisplayObject;
17+
18+
public function Test() {
19+
super();
20+
21+
trace(this.placedShape);
22+
trace(this.placedMorph);
23+
trace(this.placedSprite);
24+
trace(this.placedVideo);
25+
trace(this.placedButton);
26+
trace(this.placedText);
27+
28+
for (var i = 0; i < this.numChildren; i ++) {
29+
var child:DisplayObject = this.getChildAt(i);
30+
trace(child);
31+
if (child != null) {
32+
traceInstanceName(child.name);
33+
}
34+
}
35+
36+
var c:DisplayObject = new Bitmap();
37+
traceInstanceName(c.name);
38+
39+
c = new Shape();
40+
traceInstanceName(c.name);
41+
42+
c = new Video();
43+
traceInstanceName(c.name);
44+
}
45+
46+
static function traceInstanceName(name:String):void {
47+
if (name.indexOf("instance") == 0) {
48+
trace("instanceXX");
49+
} else {
50+
trace(name);
51+
}
52+
}
53+
}
54+
}
55+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[object Shape]
2+
[object MorphShape]
3+
[object MovieClip]
4+
[object Video]
5+
[object SimpleButton]
6+
[object StaticText]
7+
[object Shape]
8+
instanceXX
9+
[object Shape]
10+
placedShape
11+
[object MorphShape]
12+
instanceXX
13+
[object MorphShape]
14+
placedMorph
15+
[object MovieClip]
16+
instanceXX
17+
[object MovieClip]
18+
placedSprite
19+
[object StaticText]
20+
instanceXX
21+
[object StaticText]
22+
placedText
23+
[object Video]
24+
instanceXX
25+
[object Video]
26+
placedVideo
27+
[object SimpleButton]
28+
instanceXX
29+
[object SimpleButton]
30+
placedButton
31+
instanceXX
32+
instanceXX
33+
instanceXX
987 Bytes
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
num_frames = 1
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[object Shape]
2+
[object MorphShape]
3+
[object MovieClip]
4+
[object Video]
5+
[object SimpleButton]
6+
[object StaticText]
7+
[object Shape]
8+
instanceXX
9+
[object Shape]
10+
placedShape
11+
[object MorphShape]
12+
instanceXX
13+
[object MorphShape]
14+
placedMorph
15+
[object MovieClip]
16+
instanceXX
17+
[object MovieClip]
18+
placedSprite
19+
[object StaticText]
20+
instanceXX
21+
[object StaticText]
22+
placedText
23+
[object Video]
24+
instanceXX
25+
[object Video]
26+
placedVideo
27+
[object SimpleButton]
28+
instanceXX
29+
[object SimpleButton]
30+
placedButton
31+
instanceXX
32+
instanceXX
33+
instanceXX
987 Bytes
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
num_frames = 1

0 commit comments

Comments
 (0)