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