Question

Accessing a string created by an Error's getStackTrace function is resulting in very unusual behaviour in the FlashDevelop IDE.

package
{
    import flash.display.Sprite;

    public class Main extends Sprite
    {
        public function Main():void
        {
            print("Start");

            var err:Error = new Error();
            var stack:String = err.getStackTrace();

            print(stack);
            // also occurs when this is replaced with stack.length or stack[0]

            print("End");
        }

        private function print(input:*):void
        {
            trace(input);
            trace("---");
        }
    }
}

When run in flash CS4 that outputs

Start
---
Error
    at Main()
---
End
---

But when run in FlashDevelop (replacing trace() with FlashConnect.trace()) it outputs

Start
---

Is that a bug, or is it FlashDevelop handling errors in a different way intentionally?

If it is the latter is there a workaround to access the stacktrace of an error?

Was it helpful?

Solution

I managed to fix this by switching to using a dubugging version of the flash player, i hope this helps anyone else with this problem.

instructions for specifying a debug player

OTHER TIPS

Make sure you are compiling in Debug configuration and you may have to enable (set True) "Verbose Stack Trace" in your Project Properties > Compiler Options

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top