all groups > flash actionscript > april 2004 >
You're in the

flash actionscript

group:

Centering a MC


Centering a MC Dinghus
4/1/2004 11:33:34 PM
flash actionscript:
I want to attach a movie clip and center it on the stage. Is there a simple
command to do this?

And then, how do I know what a MC is using for _x and _y reference points?
Sometimes I will put in _x= 0 and it puts the middle at the far left edge.
Othertimes I put in _x=0 and it puts the left edge against the left edge.

How can I know what it is going to use for the reference?
Re: Centering a MC LA Flash Guy
4/2/2004 2:00:26 AM
Draw a square on the stage.
Select it.
Hi F8 to create a new symbol.
In the dialogue you see a little grid of squares to the right.
These are the nine basic registration points for the movieClip.
In general, I always use the upper left one so that my upper left mc corner is
the 0,0 point.

If you want to programmicly move the mc to the center of the stage, if it's
aligned to upper left
and your mc is called square:

square._x = (Stage.width - square._width) / 2;

Re: Centering a MC urami_
4/2/2004 9:59:26 AM


[quoted text, click to view]

assuming stage size is 900 x 500, place this in the first frame of attached movie

// stage size
W = 900;
H = 500;
//center based on the size
this._x = (W-_width)/2;
this._y = (H-_height)/2;


--

Regards


urami_*



<no>
http://flashfugitive.com/
</no>

AddThis Social Bookmark Button