7 Replies Latest reply on May 25, 2012 6:05 AM by Venkom

    problem

    Venkom Newcomer

      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;
                }
      }
      
        • 1. Re: problem
          Ned Murphy Legend

          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;
                    }
          }

          • 2. Re: problem
            Venkom Newcomer

            yes

            working. Thank you Ned Murphy

            • 3. Re: problem
              Venkom Newcomer

              and one more same issue pls..

              this is already string so ......

               

              upSpeeds.text = String( int(( ( uploadFile.size/tm.currentCount ) / 1024 ) * 8 )) + " Kbps";

               

              function uploadTest()

              {

              if (Number(upSpeeds.text) >= 256)

                        {

                        upPass.visible = true;

                        upFail.visible = false;

                        }

              else

                        {

                        upPass.visible = false;

                        upFail.visible = true;

                        }

              }

              • 4. Re: problem
                Ned Murphy Legend

                Show you learned something from the other and solve it.

                • 5. Re: problem
                  Venkom Newcomer

                  no, no

                  first i trying after i asking for solution. this is already i tried the as last time but not working.

                  • 6. Re: problem
                    Ned Murphy Legend

                    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.

                    1 person found this helpful
                    • 7. Re: problem
                      Venkom Newcomer

                      yaa i tried night, finally i got it.

                      Thanky you for ....

                       

                      var upSpeeds:int;

                      upSpeeds= (( ( uploadFile.size/tm.currentCount ) / 1024 ) * 8 );

                       

                      function uploadTest()

                      {

                      upSpeeds.text = upSpeeds + " Kbps";

                      if (Number(upSpeeds) >= 256)

                                {

                                upPass.visible = true;

                                upFail.visible = false;

                                }

                      else

                                {

                                upPass.visible = false;

                                upFail.visible = true;

                                }

                      }