How to Parse (File, Package, Function Name) from a Stack Trace in ActionScript (AS3)
Last Updated on Tuesday, 05 January 2010 20:25 Written by Nicholas Dunbar
So stack traces can look different depending on the flash player in which it is running. For example in the Flash IDE standalone player a constructor will look like this ConstructorFunctionName$iinit() but in the player running in a web page it will just look like ConstructorFunctionName(). It is handy for debugging purposes to extract data like the FLA file name of the SWF, the package where the error has been thrown, the class where the error was thrown and the function where the error was thrown.
Set as favorite
Bookmark
Email This
Hits: 1896
Comments (5)

nicholas
said:
| Building you're own debug tools? Save your self some work and look at http://www.actionscript-flash-...-for-flash Users who come across this post are often looking to create their own debug tools in the interest of saving them time they should check out Fireflash at the link provided. It is a tool that does advanced tracing in the flash/flex IDE console and also feeds debugging information out to the popular Firebug console which is awesome for debugging web applications that have interdependencies between Javascript and ActionScript 3.0 (AS3). Fireflash is unique in the fact that it allows you to browse public properties of a traced object and in turn you can open each property and view all of their properties. Peace. | |
|
report abuse
vote down
vote up
|
bas
said:
|
I use this class in flash builder. and things work most of the time. Thanks However, when a class is the root/default package, no data is found. Also I wish I would get the line number too. Error: ah an error at test::Main()[/Users/... .../src/test/Main.as:20] vs Error: ah an error at Main()[/Users/... .../src/test/Main.as:20] does not work |
|
|
report abuse
vote down
vote up
|
Jay
said:
|
Really appreciate your parsing solution; we built a utility class around it that helps give context to where trace statements are coming from when developing and debugging. Check it out. Thanks! Here's the URL to the utility class that makes use of this: http://blog.unionstudio.net/20...uggernaut/ |
|
|
report abuse
vote down
vote up
|
Write comment

