title: I want to move a random object
body: <p>I have a square and I want that when I press the button, position the square to move randomly in the program ..</p>
  
  <p>When I press the button nothing happens.</p>
  
  <p>What is wrong with this code?</p>
  
  <pre><code> var mycolor :ColorTransform = new ColorTransform();
      mycolor.color = Math.floor(Math.random() * 0xFFFFFF)
  
          var xposition:Number = Math.random() * (150 - 50) + 50;
          var yposition:Number = Math.random() * (150 - 50) + 50;
          trace(yposition);
  
          var rectangle:Shape = new Shape; // initializing the variable named rectangle
          rectangle.graphics.beginFill(0x0000FF);
          rectangle.graphics.drawRect(0,0, 100, 100); // (x spacing, y spacing, width, height
          rectangle.graphics.endFill();
          rectangle.transform.colorTransform = mycolor;
          addChild(rectangle);
  
          addEventListener(MouseEvent.CLICK, generateRandom)
  
           function generateRandom(Event:MouseEvent):void
          {
              rectangle.graphics.moveTo(100, 70);
              btn.label = "asd";
          }
  </code></pre>