It's a shame that as3 doesn't give you such a basic language feature.

Someone already filed a bug for that:
http://bugs.adobe.com/jira/browse/ASC-1733 / function name.toString() gives 
function Function(){} instead of the function
Closed as "Not a bug", the reason: "AS3 runtime does not have access to the 
program source at runtime, so Function.prototype.toString is unable to display 
original source. This is by design."
 
On Jan 28, 2010, at 1:45 AM, P T Withington wrote:

> Henry is looking into this, but basically as3 does not give you a way to get 
> the name of any random function.  The hack Raju pointed to will only let you 
> extract the name of a function you are executing, and our deprecation warning 
> needs to get that _and_ the replacement.  I don't think there is an easy way 
> around this.  We ought to just file a bug with Adobe that since they have the 
> function name in debug builds they ought to provide an introspection 
> interface to get at it!
> 
> On 2010-01-27, at 19:40, Max Carlson wrote:
> 
>> Yeah, I've noticed that - I'm pretty sure I filed a bug about it.  We'll 
>> check it out.  Thanks!
>> 
>> Regards,
>> Max Carlson
>> OpenLaszlo.org
>> 
>> On 1/27/10 1:14 AM, Raju Bitter wrote:
>>> Max,
>>> 
>>> what is the reason that the warning to use getDisplayObject() instead of 
>>> getMCRef() is not displayed correctly in DHTML? In SWF10 runtime I get the 
>>> warning
>>> 
>>> INFO #helloView.Function is deprecated. Use the #helloView.Function instead
>>> 
>>> In SWF8 and DHTML output is correct:
>>> INFO %cssview.lzx#32: #helloView.getMCRef is deprecated. Use 
>>> #helloView.getDisplayObject instead
>>> 
>>> Looking into the code 
>>> http://svn.openlaszlo.org/openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs
>>>  I see that you just dump the function reference in the warning. I guess 
>>> that's because there's no API to retrieve a function's name in AS3. There 
>>> is a workaround, though, described here:
>>> http://blogs.adobe.com/aharui/2007/10/debugging_tricks.html
>>> 
>>> For this to work, you need to turn on the -verbose-stacktraces=true 
>>> compiler option - which I'm not sure is done for OpenLaszlo.
>>> 
>>> - Raju
> 


Reply via email to