>From a person who keeps posting against the use of 'this' and who says it's 
>bad practice I'd expect something better than using 
nested functions, especially if there's no need for it whatsoever.


----- Original Message ----- 
From: "Steven Sacks | BLITZ" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Wednesday, November 08, 2006 7:23 PM
Subject: RE: [Flashcoders] EventDispatcher and onEnterFrame.... problems


Inside an onEnterFrame function you have to use "this" when referring to
things in the class (if the class extends MovieClip, which I hope it
does because only MovieClips can have onEnterFrame as far as I know).


class MyClass
{
var foo:Boolean;

function MyClass()
{
this.onEnterFrame = function()
{
this.foo = !this.foo;
this.traceFoo();
}
}
function traceFoo()
{
trace(foo);
}
}


_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to