samedi 26 septembre 2015

Error in Drag and Drop quiz done of Flash

I am trying to create a drag and drop game on flash. But i end up got one error, syntax error of #error1083,else is unexpected. The error shows at the line 42, and i dont have any idea which line should i did mistake.

Can someone tell me what is wrong with the code?

Here is the codes

    import flash.events.MouseEvent; 
    var objectoriginalX:Number;
    var objectoriginalY:Number;

    blue.buttonMode = true;
    blue.addEventListener(MouseEvent.MOUSE_DOWN, pickObject);
    blue.addEventListener(MouseEvent.MOUSE_UP, dropObject);




    green.buttonMode = true;
    green.addEventListener(MouseEvent.MOUSE_DOWN, pickObject);
    green.addEventListener(MouseEvent.MOUSE_UP, dropObject);


    red.buttonMode = true;
    red.addEventListener(MouseEvent.MOUSE_DOWN, pickObject);
    red.addEventListener(MouseEvent.MOUSE_UP, dropObject);

    function pickupObject(event:MouseEvent):void
    {
        event.target.startDrag();
        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 = event.target.name + "target" ;
    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 { // here is where i got error 1083
            event.target.x = objectOriginalX;
            event.target.y = objectOriginalY;
        }
    }

Aucun commentaire:

Enregistrer un commentaire