I am having trouble centering my loaded movieClip. I have a blank mc on the stage called pieceContainer and I can’t seem to get the loaded swf to be equally centered around the x,y of the pieceContainer. Can some one help?
function newPiece() {
// create a movieclip to hold the functionality of the peice of furniture
// keep all the furniture inside 1 clip (called 'pieceContainer') for organizational purposes
var count:Number = pieceContainer.getNextHighestDepth();
var item_mc:MovieClip = pieceContainer.createEmptyMovieClip("item_mc"+count, count);
// create a container to load the furniture swf into
var container:MovieClip = item_mc.createEmptyMovieClip("container_mc", 0);
container._x = 0;
container._y = 0;
//
// setup a MCL to handle the swf's loading, when its loaded, apply the mdar methods to it.
item_mc.mcl = new MovieClipLoader();
item_mc.mcl.addListener(mclListener_2);
item_mc.mcl.loadClip("decals/"+this.piece+".swf", container);
//
}
//
var mclListener_2:Object = new Object();
mclListener_2.onLoadInit = function(mc:MovieClip) {
//
var pxw = pieceContainer._x
var pxh = pieceContainer._y
trace(pxw)
trace(pxh)
// set variables to remember the original dimensions
var axw = mc._width;
var axh = mc._height;
trace(axw);
trace(axh);
trace(mc._x)
trace(mc._y)
// center piece
mc._y = -axw/2;
mc._x = -axh/2;