7 Replies Latest reply on Aug 30, 2007 4:24 PM by Newsgroup_User

    dropTarget in AS3

    KinseyFobes
      This is using Flash CS3 and AS3.0
      When I use dropTarget on symbols that are instantiated at design time, the dropTarget property reports the name as instance1 and instance2 instead of the names that were assigned through the properties panel.

      Most of the code came from some help files from Adobe, but here is the code. I was just using a trace command to identify the dropTarget.

      ball_mc.buttonMode = true;
      ball_mc.addEventListener(MouseEvent.CLICK, clickHandler);
      ball_mc.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownListener);
      ball_mc.addEventListener(MouseEvent.MOUSE_UP, mouseUpListener);
      function clickHandler(event:MouseEvent):void {
      trace("You clicked the ball");
      }
      function mouseDownListener(event:MouseEvent):void {
      ball_mc.startDrag();
      }
      function mouseUpListener(event:MouseEvent):void {
      trace(ball_mc.dropTarget.name);
      ball_mc.stopDrag();

      }