I read somewhere a utils to show the class + line nbr of the function who called a trace("foo") which is very handy once you start getting a lot of debug output.
Any hints on where to find it ? it was open source, maybe shown at a flex event.
trace("my debug");
> mydebug :34 bla.as3 ..
Thanks,
Greg
Here is a quick&dirty solution:
private function mytrace(s:String):void {
try {
throw new Error();
} catch (e:Error) {
var arr:Array = e.getStackTrace().split("\n", 3);
trace(arr[2] + " " + s);
}
}
For mytrace("xyz") you will get:
at Main/init() xyz
or if you compile with "-debug=true":
at Main/init()[C:\home\myproject\Main.mxml:120] xyz