Tuesday, April 21, 2009

AS3 - Use getStackTrace for debugging

You can use the getStackTrace method of an Error instance for general debugging purposes. This will output the execution stack like so:

Test condition @Error
at Untitled_fla::MainTimeline/testingSomething()
at Untitled_fla::MainTimeline/MyThing_fla::frame1()


function testingSomething():void {
if (testCondition) {
//include a stack trace with our debug trace:
trace("Test condition @" + (new Error()).getStackTrace());

No comments: