Francis,
 It worked in betas, but was removed on production build - we had to remove
samples from the chapter. In standard mode fails for us on access as well
with runtime error. More importantly, we can not extend Function datatype as
runtime fails instantiation stating that type Function is final. If that
restriction is removed, very cool OO tricks can be done.

Sincerely,
Anatole



On 12/8/06, Francis Cheng <[EMAIL PROTECTED]> wrote:

   You should be able to add properties to function objects, just as the
docs suggest. Unfortunately, it looks like this isn't working in strict mode
anymore. Oddly, it does work in standard mode, but that may not be a viable
workaround for you. I had a brief discussion about this with the engineers
that worked on it and their initial reaction was that this sounds like a
bug. I've filed it as such, and they will investigate it further.



Francis
 ------------------------------

*From:* [email protected] [mailto:[EMAIL PROTECTED] *On
Behalf Of *Derek Vadneau
*Sent:* Wednesday, December 06, 2006 8:15 AM
*To:* flexcoders
*Subject:* [flexcoders] Functions as objects



I've tried using the example from the docs where you assign the value
to a property on the function and then use arguments.callee.prop to
get the value, but Flex Builder gives me an error saying "Access of
possibly undefined property prop through a reference with static type
Function." when assigning the value to the function.

Example:
function test()
{
trace(arguments.callee.prop);
}
test.prop = "testing"; // Error

Global.as <http://global.as/> defines Function as dynamic yet FB produces
an error.

This is supposedly possible in AS3 as per:
http://livedocs.macromedia.com/flex/2/docs/00001835.html

However, if you try the last example you'll get compiler errors.

Is there a way to add properties to a function? Or is this not supported
in AS3?

--

Derek Vadneau



Reply via email to