848a0e2075dd51088ae23ebd7fea4816cce91f91
[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/2");
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/2");
29         }
30         public function Main()
31         {
32             this.test1(0,5)
33             this.test2(0)
34             trace("[exit]");
35         }
36     }
37 }