title: AS3: how to generate a random number between 10 and 20
body: <p>I have been trying to generate a random number in Flash. I have been watching videos and copying them, but when I click the button, the number does not apear in the text box.</p>
  
  <p>Here is the code I have written in an air ios game:</p>
  
  <pre><code>import flash.events.MouseEvent;
  //creating the  vars
  var difficulty;
  
  //listening for the play button to be clicked
  play_button.addEventListener(MouseEvent.CLICK, letsgotoframe2);
  
  
  //and after the listening what do the computer do!
  function letsgotoframe2(event:MouseEvent):void
  {
      gotoAndStop(2)
      }
  
  
  
  //listening for the easy button to be clicked
  Easy_button.addEventListener(MouseEvent.CLICK,letsgoeasy)
  
  
  
  
  
  
  //what  will it do when it is clicked
  function letsgoeasy(e:MouseEvent):void{
      difficulty = 1;
     var rand = (Math.random()*20)
     txt.text = String (rand);
     gotoAndStop(rand);
  }
  </code></pre>
  
  <p>PS:sorry for  the bad structure this is my first post!</p>