7 Replies Latest reply: May 30, 2012 7:47 AM by esdebon RSS

    Formula gives NaN as answer

    hhafke10

      num and genderconstant are working as integers, but the formula isn't working. I defined var drinks = 0; and var hours = 0; on another page. Any thoughts as to why this code isn't working?

       

      import flash.events.MouseEvent;

       

      mornshots_btn.addEventListener(MouseEvent.CLICK, takeShots);

       

      function takeShots(event:MouseEvent):void

      {

          drinks++;

          trace(drinks);

          mornshots.text = String(drinks);

      }

       

      hours = hours+4;

       

      var BAC1 = (drinks * 0.06 * 100 * 1.055 / num * genderconstant - 0.015 * hours);

       

      q1_btn.addEventListener(MouseEvent.CLICK, traceBAC1);

       

      function traceBAC1(event:MouseEvent):void

       

      {

          trace(BAC1)

         

      }

       

      mornshots.text = String(drinks);