1 Reply Latest reply on Feb 3, 2012 10:59 AM by Ned Murphy

    actionscript help

    aidensger Level 1

      Screen shot 2012-02-03 at 12.54.48 PM.png

       

      I need help parsing a string of random numbers from a host system to my flash file.  * below is the actionscript being used

       

      38 total numbers I am randomally selecting 10

       

      for (bo = 1; bo < 91; bo++)

      {

                _root["b" + bo]._visible = false;

      }

      amount = 38;

      contador = 0;

      k = 0;

      i = 0;

      sig.sig2.next = "";

      output = "";

       

       

      var ball:Array = new Array();

      for (i = 0; i <= (amount - 1); i++)

      {

                ball[i] = i + 1;

      }

      //trace(ball.join());

       

      var t:Number = setInterval(drawBall, 4000);

       

       

      function drawBall():Void

      {

       

                contador++;

                if (contador >= 11)

                {

                          gotoAndPlay(3);

                          clearInterval(t);

                }

                else

                {

                         k = random(amount);

                          while (ball[k] == "")

                          {

                                    k = random(amount);

                          }

                          sig.sig2.next = ball[k];

                          _root["b" + ball[k]]._visible = true;

                          sombra._x = _root["b" + ball[k]]._x;

                          sombra._y = _root["b" + ball[k]]._y;

                          sig.gotoAndPlay(2);

                          ball[k] = "";

                }

      }

       

      right now I have it set up that actionscript randomizes the number and places them on a "grid". What I am looking to do is eliminate the actionscript randomizer and replace it with the string of numbers that get sent down from the host so this is what I have for the split

       

       

      var ball1 = root.loaderInfo.parameters.KenoWinningNumbers.split("-")[0];
      var ball2 = root.loaderInfo.parameters.KenoWinningNumbers.split("-")[1];
      var ball3 = root.loaderInfo.parameters.KenoWinningNumbers.split("-")[2];
      var ball4 = root.loaderInfo.parameters.KenoWinningNumbers.split("-")[3];
      var ball5 = root.loaderInfo.parameters.KenoWinningNumbers.split("-")[4];
      var ball6 = root.loaderInfo.parameters.KenoWinningNumbers.split("-")[5];
      var ball7 = root.loaderInfo.parameters.KenoWinningNumbers.split("-")[6];
      var ball8 = root.loaderInfo.parameters.KenoWinningNumbers.split("-")[7];
      var ball9 = root.loaderInfo.parameters.KenoWinningNumbers.split("-")[8];
      var ball10 = root.loaderInfo.parameters.KenoWinningNumbers.split("-")[9];

       

       

      How would I "eliminate" the randomizer and then be able to parse the string instead.  thanks in advance

        • 1. Re: actionscript help
          Ned Murphy Adobe Community Professional & MVP

          Your data at the end appears to be AS3 code, so you'll probably have to work out getting it into the file using AS2.  Once you have that worked out... what you should do is just break the KenoWinningNumbers string into an array.  Since you already have a ball array and it isn't going to be used anymore for its original purpose just use that...

           

          ball = KenoWinningNumbers.split("-");  // the creates the complete ball array of winning numbers

           

          Then just use your contador variable that you increment and show each ball in your drawBall function...

           

          var contador = 0;

           

          var t:Number = setInterval(drawBall, 4000);

           

          function drawBall():Void

          {

                    if (contador > 9)

                    {

                              gotoAndPlay(3);

                              clearInterval(t);

                    }

                    else

                    {

                       // display the ball with the number ball[contador]                  

                    }

                    contador++;

          }

          1 person found this helpful