as3: fixes to inner method handling
[swftools.git] / lib / as3 / ok / innerfunction.as
1 package {
2     import flash.display.MovieClip
3     import flash.events.Event
4
5     public class Main extends flash.display.MovieClip {
6
7         public function test1(y:int, ...rest)
8         {
9             var a:Array = [null];
10             a[0] = function() {
11                 y = y + 1;
12             }
13             a[0]();
14             a[0]();
15             if(y!=2) trace("error")
16             else     trace("ok 1/3");
17         }
18         public function test2(y:uint)
19         {
20             var inc_y = function() {
21                 y = y + 1;
22             }
23             
24             inc_y();
25             inc_y();
26             
27             if(y!=2) trace("error")
28             else     trace("ok 2/3");
29         }
30
31         var msg:String = "ok 3/3";
32         public function test3(y:int)
33         {
34             var f = function() {
35                 trace(msg);
36             }
37             f();
38         }
39
40         public function Main()
41         {
42             this.test1(0,5)
43             this.test2(0)
44             this.test3(0)
45             trace("[exit]");
46         }
47     }
48 }