Skip navigation
Currently Being Moderated

problem

May 24, 2012 10:04 AM

Hi,

last time sinious help to me.

i using that script with little changes.

 

if i add "Kbps" in that bandwidthHandler my tests failing.

if i remove 'Kbps' that working good.

 

 

 

function bandwidthHandler(e:AppEvent):void
{
  downSpeeds.text = e.params.bandWidth +"Kbps";
  downTest();
}
 
function downTest()
{
if (Number(downSpeeds.text) >= 512)
          {
  Pass.visible = true;
  Fail.visible = false;
          }
else
          {
  Pass.visible = false;
  Fail.visible = true;
          }
}
 
Replies
  • Currently Being Moderated
    May 24, 2012 10:26 AM   in reply to Venkom

    Your problem is adding a string to a number and trying to compare it as a number...

     

    Number(downSpeeds.text) >= 512

     

    Try passing the e.params.bandWidth as an argument to the downTest function instead of using the textfield.

     

    function bandwidthHandler(e:AppEvent):void
    {
      downSpeeds.text = e.params.bandWidth +"Kbps";
      downTest(e.params.bandWidth);
    }

    function downTest(dnSpeeds:Number)
    {
    if (dnSpeeds >= 512)
              {
      Pass.visible = true;
      Fail.visible = false;
              }
    else
              {
      Pass.visible = false;
      Fail.visible = true;
              }
    }

     
    |
    Mark as:
  • Currently Being Moderated
    May 24, 2012 11:08 AM   in reply to Venkom

    Show you learned something from the other and solve it.

     
    |
    Mark as:
  • Currently Being Moderated
    May 24, 2012 12:21 PM   in reply to Venkom

    no, no

    this involves solving the same problem so you should learn from the first one and apply it to the second.  If you tried, you should show what you tried.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (1)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points