0 Replies Latest reply on Oct 23, 2008 7:34 AM by gpamy

    Drag and Drop problem

    gpamy
      I am trying to make a jigsaw puzzle type of thing and everything seems to be working, except only a small part of my draggable movie clips are clickable (see movie at www.amyandersondesign.com/halloween). For the princess, you can only click on the tiara and the fairy, only the tip of the left wing. I am not sure what I am doing wrong. Has anyone else experienced this? Any ideas?
      Thanks!
      Amy


      var counter:Number = 0;
      var startX:Number;
      var startY:Number;

      t2_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
      t2_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
      newkelly_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
      newkelly_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);



      function pickUp(event:MouseEvent):void {
      startX = event.target.x;
      startY = event.target.y;
      event.target.startDrag(true);
      }
      function dropIt(event:MouseEvent):void {
      event.target.stopDrag();
      var myTargetName:String = "target" + event.target.name;
      var myTarget:DisplayObject = getChildByName(myTargetName);
      if (event.target.dropTarget != null && event.target.dropTarget.parent == myTarget){
      reply_txt.text = "";
      event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickUp);
      event.target.removeEventListener(MouseEvent.MOUSE_UP, dropIt);
      event.target.buttonMode = false;
      event.target.x = myTarget.x;
      event.target.y = myTarget.y;
      counter++;
      } else {
      reply_txt.text = "";
      event.target.x = startX;
      event.target.y = startY;
      }

      if(counter == 2){
      reply_txt.text = "Trick or Treat!";
      }


      }
      t2_mc.buttonMode = true;
      newkelly_mc.buttonMode = true;