Laan's steps..

Feed Rss

who called my actionscript method[from]

06.08.2009, flash, by .


A good debug tip when you program in actionscript is to know who and when has called your method. This can be done by generating an error using the “throw new Error()” command inside the traced method. Through a custom error exception we can trace the stack and see the iter of the entire process.

So let’s create the method that will invoke the tracing method of the stack:

private function methodToCall() : void

Now we have to create the method that trace the stack

private function calledMethod() : void
throw new Error( “my error” );
catch ( e:Error )
trace( e.getStackTrace() );

This will be the result, showing the invocation path:

Error: my error
at myproject/calledMethod()[G:yourpath.mxml:18]
at myprojec/methodToCall()[G:yourpath.mxml:11]
at myprojec/Button1_click()[G:yourpath.mxml:4]


电子邮件地址不会被公开。 必填项已用 * 标注


您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>