all groups > flash actionscript > january 2008 >
You're in the

flash actionscript

group:

Code in AS3 Manual not compiling


Code in AS3 Manual not compiling RobinsEgg
8/9/2007 11:43:02 PM
flash actionscript: The following AS 3.0 code snippet from the manual (page 135):

//************************************

//Compiles only in standard mode
someFunction.counter = 0;

function someFunction():void
{
someFunction.counter++;
}

someFunction();
someFunction();
trace(someFunction.counter); // 2

//************************************

generates the following error when testing the movie:

ReferenceError: Error #1056: Cannot create property counter on
builtin.as$0.MethodClosure.
at Untitled_fla::MainTimeline/Untitled_fla::frame1()

I've tried using both Standard and Strict compiler modes.

Can anyone shed some light on the issue?:confused;
Re: Code in AS3 Manual not compiling RobinsEgg
8/10/2007 1:15:51 AM
RE: Code in AS3 Manual not compiling suvcon
1/8/2008 11:45:53 AM
ok,man,this is really a myth for you :)

try this:

var foo:Function =function(){
foo["counter"]++;
}
foo["counter"]=0;

foo();
foo();
trace(foo["counter"]);


From http://www.developmentnow.com/g/69_2007_8_0_0_1004579/Code-in-AS3-Manual-not-compiling.htm

Posted via DevelopmentNow.com Groups
AddThis Social Bookmark Button