<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Sneaky Flex trick to get the name of any calling functions</title>
	<atom:link href="http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/feed/" rel="self" type="application/rss+xml" />
	<link>http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/</link>
	<description>A blog about Adobe Flex</description>
	<lastBuildDate>Thu, 09 Feb 2012 13:51:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
	<item>
		<title>By: Arodicus</title>
		<link>http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/comment-page-1/#comment-209386</link>
		<dc:creator>Arodicus</dc:creator>
		<pubDate>Thu, 06 May 2010 22:53:01 +0000</pubDate>
		<guid isPermaLink="false">http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/#comment-209386</guid>
		<description>Great tip! Really saved my butt!

Note: Alan Shaw&#039;s example is great but has a flaw: If a class or method contains the letters &quot;at&quot; you&#039;ll get bogus results.

Corrected version:

		public function functionName():String
		{
			var result:String = &quot;&quot;;
			try {
				var stack:String = new Error().getStackTrace();
				var stackArray:Array = stack.split(&quot;\n\tat&quot;);
				var subStack:String = stackArray[3]; // because this is the 3rd function away from the caller... we want the caller
				var j:int = subStack.indexOf(&quot;()&quot;);
				result = subStack.substring(0, j+2);
			
			} catch(e) {}
			return result;
		}</description>
		<content:encoded><![CDATA[<p>Great tip! Really saved my butt!</p>
<p>Note: Alan Shaw&#8217;s example is great but has a flaw: If a class or method contains the letters &#8220;at&#8221; you&#8217;ll get bogus results.</p>
<p>Corrected version:</p>
<p>		public function functionName():String<br />
		{<br />
			var result:String = &#8220;&#8221;;<br />
			try {<br />
				var stack:String = new Error().getStackTrace();<br />
				var stackArray:Array = stack.split(&#8220;\n\tat&#8221;);<br />
				var subStack:String = stackArray[3]; // because this is the 3rd function away from the caller&#8230; we want the caller<br />
				var j:int = subStack.indexOf(&#8220;()&#8221;);<br />
				result = subStack.substring(0, j+2);</p>
<p>			} catch(e) {}<br />
			return result;<br />
		}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The getStackTrace Super Bug @ Bill White&#8217;s Blog</title>
		<link>http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/comment-page-1/#comment-208246</link>
		<dc:creator>The getStackTrace Super Bug @ Bill White&#8217;s Blog</dc:creator>
		<pubDate>Mon, 03 Aug 2009 23:44:40 +0000</pubDate>
		<guid isPermaLink="false">http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/#comment-208246</guid>
		<description>[...] made good use of a tip I picked up from McCune on generating a stacktrace in my logging statements so that I can not only see the method that was [...]</description>
		<content:encoded><![CDATA[<p>[...] made good use of a tip I picked up from McCune on generating a stacktrace in my logging statements so that I can not only see the method that was [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The Error.getStackTrace() Smart Bug @ Bill White&#8217;s Blog</title>
		<link>http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/comment-page-1/#comment-208232</link>
		<dc:creator>The Error.getStackTrace() Smart Bug @ Bill White&#8217;s Blog</dc:creator>
		<pubDate>Thu, 30 Jul 2009 21:07:30 +0000</pubDate>
		<guid isPermaLink="false">http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/#comment-208232</guid>
		<description>[...] made good use of a tip I picked up from McCune on generating a stacktrace in my logging statements so that I can not only see the method that was [...]</description>
		<content:encoded><![CDATA[<p>[...] made good use of a tip I picked up from McCune on generating a stacktrace in my logging statements so that I can not only see the method that was [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JC</title>
		<link>http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/comment-page-1/#comment-61911</link>
		<dc:creator>JC</dc:creator>
		<pubDate>Mon, 03 Mar 2008 20:10:47 +0000</pubDate>
		<guid isPermaLink="false">http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/#comment-61911</guid>
		<description>Keep in mind that if you&#039;re running the debugger, you can see the stack trace at any time within the Debug panel.  What&#039;s also nice is that if you&#039;re on a breakpoint, you can click on any of the items in the stack in that panel to switch to that object&#039;s context, ie: be able to see its variables and such.  Very handy stuff.</description>
		<content:encoded><![CDATA[<p>Keep in mind that if you&#8217;re running the debugger, you can see the stack trace at any time within the Debug panel.  What&#8217;s also nice is that if you&#8217;re on a breakpoint, you can click on any of the items in the stack in that panel to switch to that object&#8217;s context, ie: be able to see its variables and such.  Very handy stuff.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: George Cook</title>
		<link>http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/comment-page-1/#comment-59677</link>
		<dc:creator>George Cook</dc:creator>
		<pubDate>Wed, 27 Feb 2008 09:43:20 +0000</pubDate>
		<guid isPermaLink="false">http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/#comment-59677</guid>
		<description>I was sent here by a colleague who reckoned I&#039;d love this hacky solution. He was damn right! 

Lovely ! 

Thanks :)</description>
		<content:encoded><![CDATA[<p>I was sent here by a colleague who reckoned I&#8217;d love this hacky solution. He was damn right! </p>
<p>Lovely ! </p>
<p>Thanks <img src='http://dougmccune.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Almog Kurtser</title>
		<link>http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/comment-page-1/#comment-58373</link>
		<dc:creator>Almog Kurtser</dc:creator>
		<pubDate>Fri, 22 Feb 2008 18:15:25 +0000</pubDate>
		<guid isPermaLink="false">http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/#comment-58373</guid>
		<description>Hi,

that&#039;s really nice monkey you&#039;ve got :)

I think Theo and Johannes are right, mxmlc keeps the stack trace in both debug and release, it&#039;s a matter of flash player version.
I wasn&#039;t aware of the verbose-stacktraces Theo blogged about.
I guess maybe the reason they left that information in the release swf by default is to enable developers logging their apps.
Hmm..and maybe not.

Cheers,
Almog Kurtser.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>that&#8217;s really nice monkey you&#8217;ve got <img src='http://dougmccune.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I think Theo and Johannes are right, mxmlc keeps the stack trace in both debug and release, it&#8217;s a matter of flash player version.<br />
I wasn&#8217;t aware of the verbose-stacktraces Theo blogged about.<br />
I guess maybe the reason they left that information in the release swf by default is to enable developers logging their apps.<br />
Hmm..and maybe not.</p>
<p>Cheers,<br />
Almog Kurtser.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Glenn Williams</title>
		<link>http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/comment-page-1/#comment-58356</link>
		<dc:creator>Glenn Williams</dc:creator>
		<pubDate>Fri, 22 Feb 2008 15:23:17 +0000</pubDate>
		<guid isPermaLink="false">http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/#comment-58356</guid>
		<description>Hi, 

nice little trick.

Is that a new version of flexSpy, or just one you&#039;ve hacked together. I&#039;ll like the source if you&#039;re making it available.

cheers
glenn
</description>
		<content:encoded><![CDATA[<p>Hi, </p>
<p>nice little trick.</p>
<p>Is that a new version of flexSpy, or just one you&#8217;ve hacked together. I&#8217;ll like the source if you&#8217;re making it available.</p>
<p>cheers<br />
glenn</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: johannes</title>
		<link>http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/comment-page-1/#comment-58340</link>
		<dc:creator>johannes</dc:creator>
		<pubDate>Fri, 22 Feb 2008 12:36:49 +0000</pubDate>
		<guid isPermaLink="false">http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/#comment-58340</guid>
		<description>as you have the debug player it should work. try on a virgin machine with the normal runtime.

arguments.caller was very handy for event listener clean up in the past, pity tis gone when using anon functions with event listeners.</description>
		<content:encoded><![CDATA[<p>as you have the debug player it should work. try on a virgin machine with the normal runtime.</p>
<p>arguments.caller was very handy for event listener clean up in the past, pity tis gone when using anon functions with event listeners.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Theo</title>
		<link>http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/comment-page-1/#comment-58338</link>
		<dc:creator>Theo</dc:creator>
		<pubDate>Fri, 22 Feb 2008 12:21:11 +0000</pubDate>
		<guid isPermaLink="false">http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/#comment-58338</guid>
		<description>The source paths in square brackets comes from the verbose-stacktraces compiler flag. See my post on the subject: http://blog.iconara.net/2007/11/22/mxmlc-wtf-7-snooping-with-verbose-stacktraces/</description>
		<content:encoded><![CDATA[<p>The source paths in square brackets comes from the verbose-stacktraces compiler flag. See my post on the subject: <a href="http://blog.iconara.net/2007/11/22/mxmlc-wtf-7-snooping-with-verbose-stacktraces/" rel="nofollow">http://blog.iconara.net/2007/11/22/mxmlc-wtf-7-snooping-with-verbose-stacktraces/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/comment-page-1/#comment-58247</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Fri, 22 Feb 2008 03:13:14 +0000</pubDate>
		<guid isPermaLink="false">http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/#comment-58247</guid>
		<description>@Alan, hmm, interesting. All I know is that in my blog post I tried embedding a version of the app that I exported as a release build with FB 3 B3 and the getStackTrace() stuff didn&#039;t work when I viewed it on the web page (maybe my player didn&#039;t know it was supposd to be in debug mode?). So then I just re-uploaded the version that was the normal debug swf and it all worked fine for me.</description>
		<content:encoded><![CDATA[<p>@Alan, hmm, interesting. All I know is that in my blog post I tried embedding a version of the app that I exported as a release build with FB 3 B3 and the getStackTrace() stuff didn&#8217;t work when I viewed it on the web page (maybe my player didn&#8217;t know it was supposd to be in debug mode?). So then I just re-uploaded the version that was the normal debug swf and it all worked fine for me.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

