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

    problem

    Venkom Community Member

      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 CommunityMVP

          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 Community Member

            yes

            working. Thank you Ned Murphy

            • 3. Re: problem
              Venkom Community Member

              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 CommunityMVP

                Show you learned something from the other and solve it.

                • 5. Re: problem
                  Venkom Community Member

                  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 CommunityMVP

                    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.

                    • 7. Re: problem
                      Venkom Community Member

                      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;

                                }

                      }