Dear all,
The code below is used to create one rectangle at a time when a button pressed. But they are randomly placed on the screen. I was trying to drag each and place each rectangle in a desired location on screen.
But when I drag a rectangle (startDrag) with MouseDown ONLY THE FIRST CREATED RECTANGLE IS MOVED AND NOT OTHER RECTANGLES. Can you throw some light on it please?
var i = 0
function newRectangle(x1,y1){
var r:MovieClip = this.createEmptyMovieClip(“rectangles”+i, (i+2));
r.beginFill(0xcc00cc, 100);
r.moveTo(20, 20);
r.lineTo(140, 20);
r.lineTo(140, 80);
r.lineTo(20, 80);
r.endFill();
r._x = x1
r._y = y1
i++
r.createTextField(“txt”,2,25,25,10,10)
r.txt.text = "Statement " + i
r.txt.autoSize = true
r._alpha = 100;
r.onMouseDown= function(){
startDrag(this);}
r.onMouseUp = function() {
stopDrag();}
}