Stage Properties

How do i use the attachMovie command to center a movie upon the main stage’s center?

um… well after you attach the movie, make it invisible, then you find out the height and width of the stage devide by 2 and then reference the newly attached movie, helps if you use code like:

newMovie = containerMC.attachMovie("someMovie", "someMovie1", getNextHighestDepth());

then all you have to do is use newMovie._x = stageX; where stageX is equal to the stage width devided by 2. make sure the containerMC reference point is centered!

top of the google response: http://actionscript-toolbox.com/sampleattachmovie.php

i’m sorry, i should have been more specific. Basically i’m using the XML-Menu tutorial. I’m generating menu buttons from an XML file. I’m setting the menu buttons to be displayed horizontally. These menu buttons are what i want centered.

Normally, i’d put some static value in for menu_item._x (like menu_item._x = 300) to make the buttons look centered. The problem arises in the fact that there’s not always going to be the same number of menu buttons. If the site design changes, there may be 5 buttons, or maybe 3 buttons, etc. Thus i cant just put in a static value, i’d have to put in some variable that changes with the number of buttons that would make the buttons centered.

I really hope i didn’t confuse anyone with that explanation. I’d appreciate any ideas.