package { import flash.sampler.*; import flash.system.*; import flash.display.Sprite; import flash.utils.*; public class getInvocationCountTest extends Sprite { public function exec3() {} public function getInvocationCountTest() { for(var i:int=0;i<10;i++) exec(); for(var i:int=0;i<10;i++) exec2(); for(var i:int=0;i<10;i++) exec3(); // get exec QName var execName:QName; var name:QName; var fooName:QName; for each(name in getMemberNames(this)) { if(name.localName == "exec") execName = name; if(name.localName == "foo") fooName = name; } var exec2Name:QName; for each(name in getMemberNames(getInvocationCountTest)) { if(name.localName == "exec2") exec2Name = name; } // execute get/set foo = "bar"; // trace(isGetterSetter(this, fooName)); trace(getSetterInvocationCount(this, fooName) == 1); trace(getGetterInvocationCount(this, fooName) == 0); foo; trace(getSetterInvocationCount(getInvocationCountTest, fooName) == 1); trace(getGetterInvocationCount(getInvocationCountTest, fooName) == 1); trace(getInvocationCount(this, execName) == 10); trace(getInvocationCount(getInvocationCountTest, execName) == 10); trace(getInvocationCount(getInvocationCountTest, exec2Name) == 10); trace(getInvocationCount(getInvocationCountTest, undefined) == 1); getTimer(); getTimer(); trace(getInvocationCount(undefined, new QName("", "trace")) == 9); trace(getInvocationCount(undefined, new QName("flash.utils", "getTimer")) == 2); trace(getInvocationCount(undefined, new QName("", "exec3")) == 10); } private function exec():void {} private static function exec2():void {} private function get foo():String { return "fo"; } private function set foo(s:String) { } } }