2 Replies Latest reply on Mar 31, 2011 10:38 AM by kglad

    Dynamic text wont work

    SorJai225 Level 1

       

      function pickUp(event:MouseEvent):void {

          event.target.startDrag(true);

          replytxt.text = "";

          event.target.parent.addChild(event.target);

          startX = event.target.x;

          startY = event.target.y;

      }

      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){

              replytxt.text = "Good Job!";

              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 {

              replytxt.text = "Try Again!";

              event.target.x = startX;

              event.target.y = startY;

          }

          if(counter == 6){

              replytxt.text = "Congratulations, you've finished!";

          }

      }

      For some reason, my dynamic text wont work. There is only one keyframe for the text... does anyone know whats the problem?