Eric,
The example you're referring to comes up when the authors of that text are
explaining the concept of encapsulation. It's a way of creating an
onEnterFrame event on the same timeline as the code. It doesn't actually
have anything to do with classes.
If you have a class that extends the movieClip class and want an object of
that class to do something at each enterFrame event, you'd want to use
something such as:
class myMovieClips extends MovieClip {
// PRIVATE METHODS
private function doSomething():Void {
// code here
}
// EVENT HANDLERS
function onEnterFrame():Void {
this.doSomething();
}
}
Make more sense? HTH!
...Rob
_________________________________________
Rob Emenecker
Hairy Dog Digital
410.694.3575 (arf)
410.694.3550 (fax)
www.HairyDogDigital.com
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of eric cash
Sent: Tuesday, February 06, 2007 10:42 PM
To: [email protected]
Subject: [Flashcoders] var (eventHandler)
Okay, I'm guessing it's a stupid question, so I'll get over it asap.
I've never written a custom class before, and have recently started to code
things in Flash which are much more complex, approaching application status,
so I'm trying to wwrap my head around all of this OOP stuff. I keep running
into something that I can't get though...
using the VAR keyword when declaring event handlers, like this example from
Object-Oriented Actionscript for Flash 8:
var onEnterFrame:Function = doSomething;
I've Googled my [EMAIL PROTECTED] off, and I can't get it to save my life, and
this seemed
like the best place to ask. Will one of you take a couple minutes out of
your day to help a poor guy out?
Thanks
ec
_______________________________________________
[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