2 // makeswf -o PrototypeEventListeners.swf ../Dejagnu.swf PrototypeEventListeners.as
5 #include "../actionscript.all/check.as"
6 #include "../actionscript.all/utils.as"
8 #define info _root
.note
9 #define note _root
.note
10 #define fail_check _root
.fail
11 #define pass_check _root
.pass
12 #define xfail_check _root
.xfail
13 #define xpass_check _root
.xpass
22 MovieClip.prototype
.onMouseDown
= function() {
23 note
(this+".onMouseDown");
24 check_equals
(typeof(this), "movieclip");
28 MovieClip.prototype
.onKeyUp
= function() {
29 note
(this+".onKeyDown");
34 TextField.prototype
.onMouseDown
= function() {
35 note
(this+".onMouseDown");
40 createEmptyMovieClip
("clip1", 1);
48 createEmptyMovieClip
("clip2", 2);
62 note
("1. Click the mouse anywhere!");
63 _root
.onMouseDown
= function()
65 // clip1, clip2, and 2 Dejagnu clips.
66 check_equals
(countMC
, 4);
74 clip1
.removeMovieClip
();
75 note
("2. Click the mouse anywhere!");
77 _root
.onMouseDown
= function()
79 // clip2 and 2 Dejagnu clips.
80 check_equals
(countMC
, 3);
88 advancer
= new Object;
89 Key
.addListener
(advancer
);
92 countOtherFunctions
= 0;
94 clip1
.removeMovieClip
();
95 note
("3. Press a key!");
97 _root
.onKeyDown
= function()
99 // clip2 and 2 Dejagnu clips.
100 countOtherFunctions
++;
103 clip2
.onKeyDown
= function()
105 // clip2 and 2 Dejagnu clips.
106 countOtherFunctions
++;
109 advancer
.onKeyDown
= function()
111 check_equals
(countMC
, 0);
112 check_equals
(countOtherFunctions
, 0);
118 endOfTest
= function()
121 _root
.ENDOFTEST
= true;