aabad2dcd9cd88bace06cb2098736e95220bda08
[swftools.git] / lib / as3 / ok / namespaces1.as
1 package my.namespaces { 
2     public namespace ns1 = "http://www.some.other/namespace";
3     public namespace ns2 = "http://www.swftools.org/";
4     public namespace ns3 = "http://yet.some.other/namespace";
5     public namespace ns4 = "bla bla";
6
7     public class Test {
8
9         ns1 static function test() {
10             trace("error");
11         }
12         ns2 static function test() {
13             trace("ok 2/4");
14             use namespace my.namespaces.ns2;
15             (new Test()).test2()
16         }
17         ns3 static function test() {
18             trace("error");
19         }
20
21         ns1 function test2() {trace("error");}
22         ns2 function test2() {trace("ok 3/4");}
23         ns3 function test2() {trace("error");}
24
25         ns4 static function test3() {
26             trace("ok 4/4");
27         }
28     }
29 }
30     
31 package {
32
33     import flash.display.MovieClip
34     import flash.utils.Proxy
35     import flash.utils.flash_proxy
36
37     use namespace flash.utils.flash_proxy;
38     
39     public namespace ns4clone = "bla bla";
40     use namespace ns4clone;
41
42     public class Main extends flash.display.MovieClip {
43
44         use namespace my.namespaces.ns2;
45
46         private function test1() {
47             my.namespaces.Test.test()
48         }
49
50         public function Main() 
51         {
52             var p:Proxy = new Proxy
53             try {
54                 p.hasProperty("test")
55             } catch(e:Error) {
56                 // Proxy is similar to an interface, and will throw some kind
57                 // of "class not implemented" exception
58                 trace("ok 1/4");
59             }
60             my.namespaces.Test.test()
61
62             my.namespaces.Test.test3()
63             trace("[exit]");
64         }
65     }
66 }
67