2 Replies Latest reply on Sep 6, 2016 6:29 AM by Preran

    Error 1084.

    eChris Level 1

      Hey,

       

      So after about an hours worth of googling to no success, I decided I might ask here. I'm constantly getting this error in my code for a drag and drop game I'm developing for a project. I'm still learning so any help is appreciated.

      Scene 1, Layer 'Actions', Frame 4

      1084: Syntax error: expecting rightbrace before end of program.'

       

      Code:

       

      var objectoriginalX:Number;

      var objectoriginalY:Number;

       

       

      dynamics1.buttonMode = true;

      dynamics1.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);

      dynamics1.addEventListener(MouseEvent.MOUSE_UP, dropObject);

       

       

      dynamics2.buttonMode = true;

      dynamics2.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);

      dynamics2.addEventListener(MouseEvent.MOUSE_UP, dropObject);

       

       

      dynamics3.buttonMode = true;

      dynamics3.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);

      dynamics3.addEventListener(MouseEvent.MOUSE_UP, dropObject);

       

       

      pitches1.buttonMode = true;

      pitches1.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);

      pitches1.addEventListener(MouseEvent.MOUSE_UP, dropObject);

       

       

      pitches2.buttonMode = true;

      pitches2.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);

      pitches2.addEventListener(MouseEvent.MOUSE_UP, dropObject);

       

       

      pitches3.buttonMode = true;

      pitches3.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);

      pitches3.addEventListener(MouseEvent.MOUSE_UP, dropObject);

       

       

      textures1.buttonMode = true;

      textures1.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);

      textures1.addEventListener(MouseEvent.MOUSE_UP, dropObject);

       

       

      textures2.buttonMode = true;

      textures2.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);

      textures2.addEventListener(MouseEvent.MOUSE_UP, dropObject);

       

       

      textures3.buttonMode = true;

      textures3.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);

      textures3.addEventListener(MouseEvent.MOUSE_UP, dropObject);

       

       

      timbres1.buttonMode = true;

      timbres1.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);

      timbres1.addEventListener(MouseEvent.MOUSE_UP, dropObject);

       

       

      timbres2.buttonMode = true;

      timbres2.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);

      timbres2.addEventListener(MouseEvent.MOUSE_UP, dropObject);

       

       

      timbres3.buttonMode = true;

      timbres3.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);

      timbres3.addEventListener(MouseEvent.MOUSE_UP, dropObject);

       

       

      rhythms1.buttonMode = true;

      rhythms1.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);

      rhythms1.addEventListener(MouseEvent.MOUSE_UP, dropObject);

       

       

      rhythms2.buttonMode = true;

      rhythms2.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);

      rhythms2.addEventListener(MouseEvent.MOUSE_UP, dropObject);

       

       

      rhythms3.buttonMode = true;

      rhythms3.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);

      rhythms3.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;

      }

      }