X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fas3%2Fok%2Fnamespaces1.as;h=e289ac329e671a55bf53a18b55302d2e9b201b5b;hb=97a49a511ccafbbff3b49ec90af761244d3a9227;hp=d33f22a31503a102d5ea89fa2c2950d410b61c11;hpb=51521e76601a214a882f503bf9a36743035e6080;p=swftools.git diff --git a/lib/as3/ok/namespaces1.as b/lib/as3/ok/namespaces1.as index d33f22a..e289ac3 100644 --- a/lib/as3/ok/namespaces1.as +++ b/lib/as3/ok/namespaces1.as @@ -1,21 +1,70 @@ +package my.namespaces { + public namespace ns1 = "http://www.some.other/namespace"; + public namespace ns2 = "http://www.swftools.org/"; + public namespace ns3 = "http://yet.some.other/namespace"; + public namespace ns4 = "bla bla"; + + public namespace ns5 = "bla bla 2"; + + public class Test { + + ns1 static function test() { + trace("error"); + } + ns2 static function test() { + trace("ok 2/4"); + use namespace my.namespaces.ns2; + (new Test()).test2() + } + ns3 static function test() { + trace("error"); + } + + ns1 function test2() {trace("error");} + ns2 function test2() {trace("ok 3/4");} + ns3 function test2() {trace("error");} + + ns4 static function test3() { + trace("ok 4/4"); + } + } +} + package { import flash.display.MovieClip import flash.utils.Proxy import flash.utils.flash_proxy - + use namespace flash.utils.flash_proxy; + + public namespace ns4clone = "bla bla"; + use namespace ns4clone; public class Main extends flash.display.MovieClip { + use namespace my.namespaces.ns2; + import my.namespaces.*; + use namespace ns5; + + private function test1() { + my.namespaces.Test.test() + } + public function Main() { var p:Proxy = new Proxy try { p.hasProperty("test") } catch(e:Error) { + // Proxy is similar to an interface, and will throw some kind + // of "class not implemented" exception + trace("ok 1/4"); } - trace("ok 1/1"); + my.namespaces.Test.test() + + my.namespaces.Test.test3() + trace("[exit]"); } } }