I am having trouble rotating items I click on after I have added them to the stage. I can rotate the last item added but if I click off and click a different item I am unable to rotate it. Can someone show me how this would be done.
_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 = floor.pieceContainer.getNextHighestDepth();
var item_mc:MovieClip = pieceContainer.createEmptyMovieClip("item_mc"+count, count, this.getNextHighestDepth());
// 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++;
//
//add value of width and depth to text box
item_w.text = j;
item_h.text = k;
}
//
//
var mclListener_2:Object = new Object();
mclListener_2.onLoadInit = function(mc:MovieClip) {
// set variables to remember the original dimensions
_global.axw = mc._width;
_global.axh = mc._height;
// center piece
mc._y = -(axh/2);
mc._x = -(axw/2);
//
pieceContainer._x = floor._x+(wide/2);
pieceContainer._y = floor._y+(high/2);
// set drag boundries
left = -(wide/2)+axw/2;
top = -(high/2)+axh/2;
right = (wide/2)-axw/2;
bottom = (high/2)-axh/2;
//
var pItem = mc;
//
mc._parent.onPress = function() {
//trace(pItem);
this.startDrag(false, left, top, right, bottom);
};
mc._parent.onRelease = function() {
stopDrag();
_global.pX = this._x;
_global.pY = this._y;
};
//
rotate_btn.onRelease = function() {
pItem._rotation += 45;
};
};