//drag函數,定義在圖片上按下按鈕時發生動作 function drag(me:MouseEvent):void{ me.currentTarget.useHandCursor = true;//這個影片片段顯示手指游標 var object=me.target;//取得目標名稱 if(object.enabled==true){//拖曳前先判斷如果元件啟用狀態為true,才能拖曳 //將目標交換到容器(這個場景)的最上方 this.setChildIndex(object,this.numChildren-1); //開始拖曳目標 me.currentTarget.startDrag(); } } //dragStop函數,定義放開圖片發生動作 function dragStop(me:MouseEvent):void{ me.target.stopDrag();//停止拖曳 var object=me.target;//取得目標實體 switch(object){ case pic1_mc : if (me.currentTarget.hitTestObject(hittest1)){ pic1_mc.x=59;pic1_mc.y=95; pic1_mc.enabled = false; } break; case pic2_mc : if (me.currentTarget.hitTestObject(hittest2)){ pic2_mc.x=224.9;pic2_mc.y=95; pic2_mc.enabled = false; } break; case pic3_mc : if (me.currentTarget.hitTestObject(hittest3)){ pic3_mc.x=59;pic3_mc.y=323; pic3_mc.enabled = false; } break; case pic4_mc : if (me.currentTarget.hitTestObject(hittest4)){ pic4_mc.x=224.9;pic4_mc.y=323; pic4_mc.enabled = false; } break; } }