1 // makeswf -v 7 -r 1 -o function-apply-7.swf function-apply.as
6 function test_function
() {
7 trace
("this: " + this);
8 trace
("arguments: " + arguments.length
+ ": " + arguments);
12 var a
= new Object ();
13 a
.toString
= function () { return "a"; };
14 a
.test
= test_function
;
16 var b
= new Object ();
17 b
.toString
= function () { return "b"; };
19 var fake_array
= new Object ();
23 fake_array
.length
= 3;
25 trace
("Testing: (no arguments)");
26 trace
(a
.test
.apply
());
28 trace
(a
.test
.apply
(a
));
29 trace
("Testing: a, [1, 2, 3]");
30 trace
(a
.test
.apply
(a
, [1, 2, 3]));
31 trace
("Testing: a, [1, 2, 3], [4, 5]");
32 trace
(a
.test
.apply
(a
, [1, 2, 3], [4, 5]));
33 trace
("Testing: a, 1, [2, 3]");
34 trace
(a
.test
.apply
(a
, 1, [2, 3]));
35 trace
("Testing: a, 1, 2, 3");
36 trace
(a
.test
.apply
(a
, 1, 2, 3));
37 trace
("Testing: a, fake_array");
38 trace
(a
.test
.apply
(a
, fake_array
));
39 trace
("Testing: b, [1, 2, 3]");
40 trace
(a
.test
.apply
(b
, [1, 2, 3]));
42 for (var i
= 0; i
< values
.length
; i
++) {
43 trace
("Testing: " + names
[i
] + ", [1, 2, 3]");
44 trace
(a
.test
.apply
(values
[i
], [1, 2, 3]));
47 loadMovie
("FSCommand:quit", "");