I haven't done animations so I can't really help you there, but as for
your other question:

* what's better practice: creating an emptyclip on the parent outside the
class and pass the empty instance in to the constructor, or pass the parent
in and let the class create an empty clip if needed?

I tend to do both. :)

Specifically, I usually have a constructor which takes in the movie
clip it should use as its root clip (the empty clip you mention), and
then have a static factory method which takes the parent clip, creates
an empty clip, and then constructs the class.  So, something like:

class MyClipWrapper {
 private var myRoot:MovieClip;

 function MyClipWrapper(root:MovieClip, ...) {
   myRoot = root;
   /* the rest of your initialization */
 }

 public static function createMyClipWrapper(parent:MovieClip, ...,
name:String, depth:Number):MyClipWrapper {
   if(depth == undefined) {
     depth = root.getNextHighestDepth();
   }
   var empty:MovieClip = parent.createEmptyMovieClip(name, depth);
   return new MyClipWrapper(empty, ...);
 }
}

  -Andy

On 5/10/07, Hans Wichman <[EMAIL PROTECTED]> wrote:
Hi list,

when programming in AS2 i usually favor composition over inheritance, so eg
when i have a button i create a class for it passing in a parent container
and the class attaches all the objects it needs on the parent and wraps it.

However when i want to animate a number of these buttons with respect to
eachother in a startup animation for example, the composition thing tends to
make things more complicated then necessary.
I either need to:
* add a getInnerClip to the class so i can get the inner clip and animate it
in all kinds of weird ways (violating encapsulation), or
* I need to add a lot of movieclips properties/methods to the compositing
class (but maybe thats just the way it is), or
* put all the animation code within such a class, which doesnt sound that
good either

I was wondering what approach u guyz ussually take?

In addition with respect to the composition thing:
* what's better practice: creating an emptyclip on the parent outside the
class and pass the empty instance in to the constructor, or pass the parent
in and let the class create an empty clip if needed?
Im in favor of the first, since it doesnt allow to mess up the parent as
much as in the latter option, but again it involves a trade off of control.

The specific situation I'm dealing with is a visual object that consist of
an alpha shadow on a floor layer and the object causing the shadow on an
item layer. Clearly the shadow's and item's movement are related, so I would
like to wrap these two items in one class, and then use this single instance
in an animation where the whole thing is for example blurred based on its
speed.

 Making any sense?
thanks for your ideas!

JC
_______________________________________________
Flashcoders@chattyfig.figleaf.com
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

_______________________________________________
Flashcoders@chattyfig.figleaf.com
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