使用动作脚本匹配测验

时间:2013-12-06 06:31:23

标签: actionscript-3

我在flash专业人士中创建了一个匹配的测验,但是当用户正确回答并希望导航到第二页时,匹配问题的答案会出现在第二个场景中然后它会在下一个场景中消失后如何能够消失我解决了这个问题?

 var objectoriginalX:Number;
var objectoriginalY:Number;
polygon_mc.buttonMode=true;
polygon_mc.addEventListener(MouseEvent.MOUSE_DOWN,pickupObject);
polygon_mc.addEventListener(MouseEvent.MOUSE_UP,dropObject);
circle_mc.buttonMode=true;
circle_mc.addEventListener(MouseEvent.MOUSE_DOWN,pickupObject);
circle_mc.addEventListener(MouseEvent.MOUSE_UP,dropObject);
square_mc.buttonMode=true;
square_mc.addEventListener(MouseEvent.MOUSE_DOWN,pickupObject);
square_mc.addEventListener(MouseEvent.MOUSE_UP,dropObject);
function pickupObject(event:MouseEvent):void{
event.target.startDrag(true);
event.target.parent.addChild(event.target);
objectoriginalX=event.target.x;
objectoriginalY=event.target.y;
}
function dropObject(event:MouseEvent):void{
event.target.stopDrag();
var matchingTargetName:String="target"+event.target.name;
var matchingTarget:DisplayObject=getChildByName(matchingTargetName);
if(event.target.dropTarget!=null&&event.target.dropTarget.parent==matchingTarget){
event.target.removeEventListener(MouseEvent.MOUSE_DOWN,pickupObject);
event.target.removeEventListener(MouseEvent.MOUSE_UP,dropObject);
event.target.buttonMode=false;
event.target.x=matchingTarget.x;
event.target.y=matchingTarget.y;
}
else{event.target.x=objectoriginalX;
event.target.y=objectoriginalY;
}}

这是打印屏幕 output

0 个答案:

没有答案