2 // This ActionScript code is intended to be compiled in the third frame
3 // of a movie so composed:
5 // frame2) A bitmap DisplayObject named 'green'
7 // The aim is testing clashes between a variable name
8 // and a display list DisplayObject name
11 // Move the 'green' DisplayObject on the right
12 // so that Dejagnu.swf xtrace window is visible
14 green
._xscale
= green
._yscale
= 50;
16 // Verify that 'green' DisplayObject is a MovieClip
17 check
(green instanceOf
MovieClip);
18 check_equals
(typeof(green
), 'movieclip');
20 // Set a reference to the movieclip
22 check_equals
(typeof(greenref
), 'movieclip');
24 // "create" a 'green' variable.
25 // The name of this variable will "clash" with the name of the
26 // existing DisplayObject (added in frame2).
27 green
= new Number(1);
29 // The *new* 'green' variable is no more a movieclip
30 check
(green instanceOf
Number);
31 check_equals
(typeof(green
), 'object');
32 check_equals
(green
._y
, undefined);
34 // The movieclip reference is still valid
35 check_equals
(typeof(greenref
), 'movieclip');
37 // Change the name of the green DisplayObject
38 greenref
._name
= "stealth";
39 check_equals
(typeof(greenref
), 'movieclip');
41 MovieClip.prototype
.stealth
= 12;
42 // Only own properties hide chars, not inherited ones
43 check_equals
(typeof(stealth
), 'movieclip');
44 greenref
._name
= "stealth2";
45 check_equals
(typeof(stealth
), 'number');
47 // print totals and stop to avoid infinite loops