for (var k:uint=0; k<8; k++) {
Draw 8 squares with a For loop
var a:sprite=new Sprite ();
A.graphics.linestyle (1);
A.graphics.beginfill (0xBBBBBB);
A.graphics.drawrect (0,0,50,50);
A.graphics.endfill ();
AddChild (A);
Arrange Squares
A.x=uint (k%4) *100+50;
A.y=uint (K/4) *100+50;
Insert dynamic text in each square
var txt:textfield=new TextField ();
Txt.autosize=textfieldautosize.left;
A.addchild (TXT);
Txt.text= "First" + (k+1) + "a";
Display a hand when you move the mouse over a square
Txt.mouseenabled=false;
A.buttonmode=true;
Add a listening event
A.addeventlistener (Mouseevent.mouse_down,ax);
A.addeventlistener (MOUSEEVENT.MOUSE_UP,SK);
}
Press the start drag
function ax (event:mouseevent): void {
Easy to manipulate a single wizard, if you drag a directly to the last one to work
var b:sprite=event.target as Sprite;
B.startdrag ();
Move the dragged wizard to the front
AddChild (B);
}
Release Stop Drag
Function SK (event:mouseevent): void {
Stopdrag ();
}