[thelist] Laying out components in Flash

Marcus Andersson marcus at bristav.se
Tue May 18 17:42:00 CDT 2004

joe wrote:

> yes.  imagine you have an empty movie clip called myContainer positioned 
> at 0,0.  something I have in every movie I make cos it's so useful.  
> (although you're a noob, I assume you understand instances and instance 
> names since you're walking xml trees :) )
> to attach another movie clip to that container, you have to export it 
> for actionscript first (right click on your movie clip in the library 
> and go to "Linkage", check the box saying "Export for actionscript", and 
> give it a name - for example "myClip").
> Then you use attachMovie thus:
> clipOne = myContainer.attachMovie("myClip", "instance1", 1);     // see 
> Flash help on attachMovie for what these params mean
> clipTwo = myContainer.attachMovie("myClip", "instance2", 2);
> this has just created two different instances of your library item, and 
> they both sit at 0,0.
> move the second one relative to the first thus:
> clipTwo._x = clipOne._x + clipOne._width + 5;     // (for example)
> move them all (by moving the container) thus:
> myContainer._x = 200;
> myContainer._y = 200;
> The point is that myClip (and anything else _in your library_, such as a 
> component which has been created for use with the createClassObject 
> method, for example) has already been "designed", which means that it 
> has got dimensions and a position relative to its own registration point.

This was a *very* useful explanation. Thanks. My biggest problem is that I'm not used to the vocabulary and 
keeps looking in the wrong directions (I'm an ordinary programming guy really and not used to working with 
movie clips that really sounds like a mpeg or something). I've been looking at the UIComponent and stuff but 
that haven't helped me much.

> Its probably useful to remember Flash evolved from being a graphical 
> tool, and acquired OO functionality, rather than vice versa...

I guess so. I have so much harder to get things done in the graphical editor than with scripting so I guess 
Flash isn't really for me. But I need it as a transport so...

Thanks again.


More information about the thelist mailing list