繁体   English   中英

如何使动作script3.0中的拖放不重叠

[英]How to make drag and drop in action script3.0 doesnt overlapping

所以我正在做一个拖放测验,有两个答案框,您可以在其中放入答案,所以我的问题是,当我在一个答案框上放答案时,我希望另一个答案不能放进入同一个答案框。 如果可以的话,我想当我放弃答案时,当我尝试将另一个答案放入其中时,它会让答案回到它上面放置测验的图片

stop();
/* Drag and Drop
Makes the specified symbol instance moveable with drag and drop.
*/
var skor4:int = 0;
skor3.text = String(skor4);

function jumlah2(){
   skor4=skor4+1;
}
tick1.visible=false;
tick2.visible=false;

cross1.visible=false;
cross.visible=false;

meso1.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);

function fl_ClickToDrag(event:MouseEvent):void
{
   meso1.startDrag();
   
}

meso1.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);

function fl_ReleaseToDrop(event:MouseEvent):void
{
   meso1.stopDrag();   
   if(meso1.hitTestObject(ruang))
   {
           jumlah2();
   skor3.text=String(skor4);
       
       meso1.x=269.4;
       meso1.y=359.45;
       tick1.visible=true;

   meso1.mouseEnabled=false;

   }
else if(meso1.hitTestObject(ruangg))
   {
       
       meso1.x=581.95;
       meso1.y=359.45;
       cross1.visible=true;
       
           Mesir1.mouseEnabled=false;
   
   Indus1.mouseEnabled=false;
       
   }
else{
   meso1.x=648;
   meso1.y=455.5;
}

}


/* Drag and Drop
Makes the specified symbol instance moveable with drag and drop.
*/

Indus1.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_2);

function fl_ClickToDrag_2(event:MouseEvent):void
{
   Indus1.startDrag();
   
}

Indus1.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_2);

function fl_ReleaseToDrop_2(event:MouseEvent):void
{
   Indus1.stopDrag();
   
   if(Indus1.hitTestObject(ruang))
   {
       Indus1.x=269.4;
       Indus1.y=359.45;
       cross.visible=true;
   Indus1.mouseEnabled=false;  
       
   }
else if(Indus1.hitTestObject(ruangg))
   {
       Indus1.x=581.95;
       Indus1.y=359.45;
       cross1.visible=true;
       Indus1.mouseEnabled=false;
       Mesir1.mouseEnabled=false;

   meso1.mouseEnabled=false;
       
   }
else{
   Indus1.x=433.95;
   Indus1.y=455.5;
}

}


/* Drag and Drop
Makes the specified symbol instance moveable with drag and drop.
*/





/* Drag and Drop
Makes the specified symbol instance moveable with drag and drop.
*/

Mesir1.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_4);

function fl_ClickToDrag_4(event:MouseEvent):void
{
   Mesir1.startDrag();

}

Mesir1.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_4);

function fl_ReleaseToDrop_4(event:MouseEvent):void
{
   Mesir1.stopDrag();
   if(Mesir1.hitTestObject(ruang))
   {
       Mesir1.x=269.4;
       Mesir1.y=359.45;
       cross.visible=true;
   Mesir1.mouseEnabled=false;
   }
else if(Mesir1.hitTestObject(ruangg))
   {
       jumlah2();
   skor3.text=String(skor4);
       Mesir1.x=581.95;
       Mesir1.y=359.45;
       tick2.visible=true;
       
       meso1.mouseEnabled=false;

   Indus1.mouseEnabled=false;
   }
else{
   Mesir1.x=226.85;
   Mesir1.y=455.5;
}

}

/* Click to Go to Frame and Play
Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and continues playback from that frame.
Can be used on the main timeline or on movie clip timelines.

Instructions:
1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
*/

cont.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_31);

function fl_ClickToGoToAndPlayFromFrame_31(event:MouseEvent):void
{
   gotoAndPlay(2);
}

/* Drag and Drop
Makes the specified symbol instance moveable with drag and drop.
*/



/* Click to Go to Scene and Play
Clicking on the specified symbol instance plays the movie from the specified scene and frame.

Instructions:
1. Replace "Scene 3" with the name of the scene you would like play.
2. Replace 1 with the frame number you would like the movie to play from in the specified scene.
*/

home3.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_76);

function fl_ClickToGoToScene_76(event:MouseEvent):void
{
   MovieClip(this.root).gotoAndPlay(1, "Scene 2");
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM