X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fas3%2Fok%2Ftrycatch.as;h=9f8dbc044a21ca289df46a760b40aeffcce0876a;hb=97a49a511ccafbbff3b49ec90af761244d3a9227;hp=c47cb6dc4b18374d4fead1cd71a251463a5bc592;hpb=d9ef7c0f7757575fb40ba2a59b5cac201a5c27fc;p=swftools.git diff --git a/lib/as3/ok/trycatch.as b/lib/as3/ok/trycatch.as index c47cb6d..9f8dbc0 100644 --- a/lib/as3/ok/trycatch.as +++ b/lib/as3/ok/trycatch.as @@ -1,12 +1,41 @@ package { import flash.display.MovieClip; + import flash.net.navigateToURL; public class MyError { } public class MyOtherError { - var ok5="ok 5/5"; + var ok5="ok 5/7"; + } + public class ClassWithStaticFunctions { + static function ok7() { + trace("ok 7/7"); + } } public class Main extends flash.display.MovieClip { + + public function getClass():Class { + return ClassWithStaticFunctions; + } + + public function checkScope():void + { + try { + flash.net.navigateToURL; + } catch (e:Error) { + } + trace("ok 6/7"); + + with(getClass()) { + try { + throw new Error; + } catch(e:Error) { + ok7(); + } + } + } + + function Main() { try { throw new MyError @@ -15,7 +44,7 @@ package { // MyError is not of the Error class trace("error"); } catch(error:MyError) { - trace("ok 1/5"); + trace("ok 1/7"); } catch(x) { trace("error"); } @@ -26,11 +55,11 @@ package { } catch(error:MyError) { trace("error"); } catch(x:*) { // ":*" is the same as "" - trace("ok 2/5"); + trace("ok 2/7"); } try { - trace("ok 3/5"); + trace("ok 3/7"); // don't throw any error } catch(error:MyError) { trace("error"); @@ -40,14 +69,16 @@ package { trace("error"); } - trace("ok 4/5"); + trace("ok 4/7"); try {throw new MyOtherError} catch(x:*) { trace((x as MyOtherError).ok5); } - trace("[exit]"); + checkScope(); + + trace("[exit]"); } } }