title: I am Creating a simple calculator in as3 and flash
body: <p>I am creating a simple calculator in Action script 3.0 and Flash.
  below is my code. I am unable to get results although it runs correctly till <code>trace("calculating"+operator);
  </code> but doesnot show result. Why?
  If i am going wrong please suggest me the write code.</p>
  
  <pre><code>   import flash.events.MouseEvent;
  
  _1.addEventListener(MouseEvent.CLICK, inputvalues)
  _2.addEventListener(MouseEvent.CLICK, inputvalues)
  _3.addEventListener(MouseEvent.CLICK, inputvalues)
  _4.addEventListener(MouseEvent.CLICK, inputvalues)
  _5.addEventListener(MouseEvent.CLICK, inputvalues)
  _6.addEventListener(MouseEvent.CLICK, inputvalues)
  _7.addEventListener(MouseEvent.CLICK, inputvalues)
  _8.addEventListener(MouseEvent.CLICK, inputvalues)
  _9.addEventListener(MouseEvent.CLICK, inputvalues)
  _0.addEventListener(MouseEvent.CLICK, inputvalues)
  _add.addEventListener(MouseEvent.CLICK, inputvalues)
  _sub.addEventListener(MouseEvent.CLICK, inputvalues)
  _div.addEventListener(MouseEvent.CLICK, inputvalues)
  _mul.addEventListener(MouseEvent.CLICK, inputvalues)
  _equal.addEventListener(MouseEvent.CLICK, inputvalues)
  _dot.addEventListener(MouseEvent.CLICK, addDot);
  _clear.addEventListener(MouseEvent.CLICK, clearscr);
  
  var operator: String = "";
  var value1: Number;
  var value2: Number;
  function inputvalues(e: MouseEvent): void {
  
          var valuestring: String = e.currentTarget.name
          valuestring = valuestring.substr(1);
  
  
  
          if (valuestring.length &gt; 1) {
  
              operator = valuestring
              if (operator != "equal") {
  
                  value1 = Number(this.display_txt.text)
                  this.display_txt.text = "";
  
              }else{
                  value2 = Number(this.display_txt.text)
  
                  calculatevalue();
  
                  }
  
          } else {
              this.display_txt.text = this.display_txt.text +valuestring;
          }
  
      }
  
      function calculatevalue() {
          trace("calculating"+operator);
          if (operator=="add")
          {
  
              this.display_txt.text = String(value1+value2);}
  
          }
      function clearscr(event:MouseEvent):void
        {
              display_txt.text="";
        }
       function addDot(event:MouseEvent):void
        {
          if (value1 == Number(display_txt.text))
         {
              display_txt.text = "0";
         }
           if (display_txt.text.indexOf(".") == -1)
         {
              display_txt.appendText(".");
         }
        }
  </code></pre>