title: Move a character in flash randomly
body: <p>I have a character imported to my stage, but I want a button called "Random" that when hit, moves the character either up down left or right, every time you click it. Here's what I tried, but the character will just move diagonally. </p>
  
  <pre><code>//import the code to use the components
  import fl.events.ComponentEvent;
  import flash.utils.Timer;
  import flash.events.TimerEvent;
  
  //stay on this frame
  stop();
  
  //declare variables
  var RandomNumber:Number = Math.floor(Math.random() * 5) -5;
  var XMove:Number;
  var YMove:Number;
  var tmrMove:Timer = new Timer(25);
  
  
  btnRandom.addEventListener(ComponentEvent.BUTTON_DOWN, RandomNum); 
  //listen for timer to tick
  tmrMove.addEventListener(TimerEvent.TIMER, onTick);
  
  
  function RandomNum(e:ComponentEvent) {
      XMove = RandomNumber;
      YMove = RandomNumber;
      tmrMove.start()
  }
  
  //function for timer
  function onTick (e:TimerEvent) {
  //move the ninja
  picNinja.x = picNinja.x + XMove;
  picNinja.y = picNinja.y + YMove;
  
  //check if ninja goes off stage
  if (picNinja.x &gt; stage.stageWidth) {
      picNinja.x = 0;
  }
  if (picNinja.x &lt; 0) {
      picNinja.x = stage.stageWidth;
  }
  if(picNinja.y &gt; stage.stageHeight) {
      picNinja.y = 0;
  }
  if(picNinja.y &lt; 0) {
      picNinja.y = stage.stageHeight;
  }
  
  
  //function to stop the timer
  function stopApp (e:ComponentEvent) {
  tmrMove.stop();
  }
  </code></pre>
  
  <p>I thought assigning a random value would work(between 5 and -5) but something is definitely wrong here. </p>