The reason I don't like extending MovieClip is that it gives the user of my classes too much control over the internals of my class.
Specifically, if I'm wrapping MovieClip I'm generally creating something with a lot of special behavior, which sometimes causes restrictions on things like position and size. If I extend MovieClip then all the built in MovieClip functions and properties are user-visible, so there's really nothing stopping someone from just doing myClass._width, etc. By using Composition I can restrict the public API to my class to exactly those methods I want exposed. All the extra internal state that MovieClip makes visible is no longer visible to the user of my class. Now granted, if I'm the only one using my classes then you could argue that there's really no difference, as I should just stick to using the functions. However, I like to code defensively and assume that, at some point, others will be using/modifying my code. Using Composition makes it much easier to do that. -Andy On 8/13/07, Michael Trim <[EMAIL PROTECTED]> wrote: > >Not all classes have to extend MovieClip (in fact, most shouldn't, and > some would argue none should). > > Just as an aside, I'd be interested to hear why some would argue that > you should never extend MovieClip? (Surely you have to for the Document > class) or is this a higher level theoretical argument? > _______________________________________________ > [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 > _______________________________________________ [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

