var score:Number=0; import flash.utils.*; var numClips:Number=8; var s:int = 0; //array to hold puzzle peices that will be avalable to drag var myClip = new Array(numClips); var timer:Timer = new Timer(250); timer.addEventListener(TimerEvent.TIMER, count10thSeconds); function count10thSeconds(evt:TimerEvent):void { s++; } // populate the myClip array with the movie clips from the library myClip[0] = addChild(new a0()); myClip[1] = addChild(new a1()); myClip[2] = addChild(new a2()); myClip[3] = addChild(new a3()); myClip[4] = addChild(new a4()); myClip[5] = addChild(new a5()); myClip[6] = addChild(new a6()); myClip[7] = addChild(new a7()); //assign names to each element in the myClip array for (var p:int = 0; p < numClips; p++) { myClip[p].name = "piece" + p; myClip[p].clipNumber = p; } //array to hold the locations (little rectangles) to drag the puzzle pieces on the stage var nph = new Array(numClips); //populate array with the locations (little rectangles) placed on the stage nph[0] = nph0_mc; nph[1] = nph1_mc; nph[2] = nph2_mc; nph[3] = nph3_mc; nph[4] = nph4_mc; nph[5] = nph5_mc; nph[6] = nph6_mc; nph[7] = nph7_mc; //array to hold the original puzzle pieces on the stage var tpg = new Array(numClips); //populate the puzzle pieces array with the puzzle pieces on the stage tpg[0] = tpg0_mc; tpg[1] = tpg1_mc; tpg[2] = tpg2_mc; tpg[3] = tpg3_mc; tpg[4] = tpg4_mc; tpg[5] = tpg5_mc; tpg[6] = tpg6_mc; tpg[7] = tpg7_mc; //generate random locations (x and y positions) for the movie clips to be dragged var x0 = myClip[0].x = Math.random()*225+320; var y0 = myClip[0].y = Math.random()*310; var x1 = myClip[1].x = Math.random()*225+320; var y1 = myClip[1].y = Math.random()*310; var x2 = myClip[2].x = Math.random()*225+320; var y2 = myClip[2].y = Math.random()*310; var x3 = myClip[3].x = Math.random()*225+320; var y3 = myClip[3].y = Math.random()*310; var x4 = myClip[4].x = Math.random()*225+320; var y4 = myClip[4].y = Math.random()*310; var x5 = myClip[5].x = Math.random()*225+320; var y5 = myClip[5].y = Math.random()*310; var x6 = myClip[6].x = Math.random()*225+320; var y6 = myClip[6].y = Math.random()*310; var x7 = myClip[7].x = Math.random()*225+320; var y7 = myClip[7].y = Math.random()*310; var j:Number; msgbox_txt.text = "You can do it, " + theName + "... :-)"; timer.start(); //use a “for loop” to loop through the movie clips created and add the mouseDown and mouseUp event listeners //Call the function pieceMove on mouseUp and mouseDown for (var k:Number=0; k