I have swf being loaded onto the stage. Currently the count varies because of the getNextHighestDepth. I am trying to get the count to increment by 1, but when I do, and I add a new item replaces the existing item, which I don’t want. How can I get around this?
//_global.count = 0;
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);
trace(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 freeTransform methods to it.
item_mc.mcl = new MovieClipLoader();
item_mc.mcl.addListener(mclListener_2);
item_mc.mcl.loadClip("decals/"+this.piece+".swf", container);
//
//count++;
}
//
var mclListener_2:Object = new Object();
mclListener_2.onLoadInit = function(mc:MovieClip) {
// set variables to remember the original dimensions
var axw = mc._width;
var axh = mc._height;
//trace(axw);
//trace(axh);
// center piece
mc._y = -(axh/2);
mc._x = -(axw/2);
//
//add rotation and drag properties
mc._parent.onPress = function() {
this.addFreeTransform();
trace(mc._parent);
};
//
};