Drawing api rectangle stretching problem

hi all,
please browse the following link.

http://proto-bazar.com/sample/sample_flash/editor_ver0.html

i am trying to make an editor with flash cs4 and as3.

first time if you select only the rectangle which is in the middle tool of the toolbar.

if you drag your mouse inside the drawing area,a rectangle will be drawn and also surrounding points will draw.

but problem is that when you drag any one of the small point then the rectangle is moving to another place.

why is this problem occurring?

i have drawn the rectangle first time when mouse drag with the following function

public function square(e:Event):void
{

GL.mcRef.graphics.clear();
GL.mcRef.graphics.lineStyle(3, 0x000000, 1.0);
GL.mcRef.graphics.beginFill(0xff9900, 1.0);
GL.mcRef.graphics.drawRect(0, 0, mouseX - GL.mouseIniX, mouseY - GL.mouseIniY);
GL.mcRef.x = GL.mouseIniX;
GL.mcRef.y = GL.mouseIniY;
GL.mcRef.graphics.endFill();
}

and i am drawing the surrounding point with the following functions

public function drawPointSquare()
{
var pointRow:Number = 0;
var pointCol:Number = 0;
for(var i:uint = 0; i<6; i++)
{
Xpos = GL.activeObject.x + ((GL.activeObject.width/2) * pointCol);
if(pointRow == 1)
{
//Xpos = GL.activeObject.x;
Ypos = GL.activeObject.y + Xheight;
}
var littleSquare:Sprite = new Sprite();
addChild(littleSquare);
arrayOfLittleSquare.push(littleSquare);
littleSquare.graphics.beginFill(0x000000);
drawShape(littleSquare,10,10);
littleSquare.graphics.endFill();
littleSquare.x = Xpos;
//trace(“existing x position:”+Xpos);
littleSquare.y = Ypos;
if(i == 2)
{
pointCol = 0;
pointRow = 1;
}
else
pointCol++;
arrayOfLittleSquare*.addEventListener(MouseEvent.MOUSE_DOWN, dragSquares);
arrayOfLittleSquare*.addEventListener(MouseEvent.MOUSE_UP, stopSquares);
}
}
public function drawShape(sprite:Sprite, Width:Number, Height:Number):void
{
sprite.graphics.moveTo(-Width/2,-Height/2);
sprite.graphics.lineTo(Width/2,-Height/2);
sprite.graphics.lineTo(Width/2,Height/2);
sprite.graphics.lineTo(-Width/2,Height/2);
sprite.graphics.lineTo(-Width/2,-Height/2);
}

public function dragSquares(e:MouseEvent):void
{
e.target.startDrag();
e.target.addEventListener(Event.ENTER_FRAME, redrawShape);
}
public function stopSquares(e:MouseEvent):void
{
e.target.stopDrag();
e.target.removeEventListener(Event.ENTER_FRAME, redrawShape);
}

public function redrawShape(e:Event):void
{
drawDynamicShape(GL.activeObject);
}
public function drawDynamicShape(sprite:Sprite):void
{
trace(“active object x and y is:” + GL.activeObject.x+":"+GL.activeObject.y)

GL.activeObject.x = arrayOfLittleSquare[0].x;
GL.activeObject.y = arrayOfLittleSquare[0].y;

sprite.graphics.clear();
sprite.graphics.lineStyle(3, 0x000000, 1.0);
sprite.graphics.beginFill(0xff9900, 1.0);
sprite.graphics.moveTo(arrayOfLittleSquare[0].x,arrayOfLittleSquare[0].y);
sprite.graphics.lineTo(arrayOfLittleSquare[1].x,arrayOfLittleSquare[1].y);
sprite.graphics.lineTo(arrayOfLittleSquare[2].x,arrayOfLittleSquare[2].y);
sprite.graphics.lineTo(arrayOfLittleSquare[5].x,arrayOfLittleSquare[5].y);
sprite.graphics.lineTo(arrayOfLittleSquare[4].x,arrayOfLittleSquare[4].y);
sprite.graphics.lineTo(arrayOfLittleSquare[3].x,arrayOfLittleSquare[3].y);
sprite.graphics.lineTo(arrayOfLittleSquare[0].x,arrayOfLittleSquare[0].y);
sprite.graphics.endFill();

/*
sprite.graphics.clear();
sprite.graphics.lineStyle(3, 0x000000, 1.0);
sprite.graphics.beginFill(0xff9900, 1.0);
sprite.graphics.drawRect(0, 0, mouseX - GL.mouseIniX, mouseY - GL.mouseIniY);
sprite.x = GL.mouseIniX;
sprite.y = GL.mouseIniY;
sprite.graphics.endFill();*/
}

every thing is going well.

but i think the problem inside the drawDynamicShape function.

here the moveto method is transfering the object to other place.

actually i want to use the same square function here but how i dont know.

if any body have and idea please share it.

Thanks in advance.