Hi, i have this following code that add item dynamically to the stage. But it there is some problem with it.
For the 3rd item i insert and move, it will remove the 1st item
for the 6th item i insert and move, it will remove the 2nd item
for the 9th item i insert and move, it will remove the 3rd item
for the 12th item i insert and move, it will remove the 4th item
but the item will not be be remove if i just simple insert and not move the item. So i suspect the problem is with the "forceSelectionToFront" which kinda change the depth of the item and cause the problem.
here is my code
// transform manager
var manager_obj = new TransformManager({targetObjects:[], bounds:{xMin:-300, xMax:700, yMin:-300, yMax:650}, forceSelectionToFront:true, scaleFromCenter:true, allowDelete:true, constrainScale:true, lineColor:0xa23a3b, handleFillColor:0x888888, eventHandler:onAnyEvent});
//
// add item to stage
totalDesignItem = 1;
totalDesignCount = 0;
//
stageWidth = miniStage._width;
stageHeight = miniStage._height;
//
for (i=1; i<=totalDesignItem; i++) {
this.cpanel.panel2.elementMc["elementTn"+i].btn.onRelease = function() {
totalDesignCount += 1;
//
id = this._parent._name.substr(9, 2);
miniStage.itemHolder.attachMovie("element"+id,"stageElement"+totalDesignCount,totalDesignCount);
//
miniStage.itemHolder["stageElement"+totalDesignCount]._x = stageWidth/2;
miniStage.itemHolder["stageElement"+totalDesignCount]._y = stageHeight/2;
//
// add item to transform manager
manager_obj.addItem(miniStage.itemHolder["stageElement"+totalDesignCount]);
};
}
any idea where did i go wrong?
thanks in advance