0 Replies Latest reply on Aug 13, 2007 9:36 PM by gerraIrkutsk-vtxlyW

    Organization classes

    gerraIrkutsk-vtxlyW
      I've created two classes.

      ParentBox.as
      package {
      import flash.display.Sprite;

      public class ParentBox extends Sprite {
      public function ParentBox() {
      init();
      }
      private function init():void
      {
      graphics.lineStyle(1, 0);
      graphics.drawRect(-50, -50, 100, 100);
      }
      }
      }

      Reparenting2.as
      package {
      import flash.display.Sprite;
      import flash.events.MouseEvent;

      public class Reparenting2 extends Sprite {
      private var parent1:ParentBox;
      private var parent2:ParentBox;
      private var ball:Sprite;

      public function Reparenting2() {
      init();
      }
      private function init():void {
      parent1 = new ParentBox();
      addChild(parent1);
      parent1.x = 60;
      parent2.y = 60;

      parent2 = new ParentBox();
      addChild(parent2);
      parent2.x = 170;
      parent2.y = 60;

      ball = new Sprite();
      parent1.addChild(ball);
      ball.graphics.beginFill(0xff0000);
      ball.graphics.drawCircle(0, 0, 40);
      ball.graphics.endFill();
      ball.addEventListener(MouseEvent.CLICK, onBallClick);
      }
      public function onBallClick(event:MouseEvent):void {
      parent2.addChild(ball);
      }
      }
      }

      when I create refer for Document class as Reparenting2.as it isn't search out ParentBox. Where I can register it for correct execution?