13 Replies Latest reply on Nov 1, 2006 3:17 PM by kglad

    parsing??

    Hengy
      ok. I have a variable - imgname = 1; i want to add 1 to it (so it equals 2). is that variable a string, or an integer? and how do i convert it to an integer?

      here is some code i have for an image viewer i am making:
      frame 1:
      imgpath = "Photos/";
      imgname = 3;
      extension = ".JPG";
      alpha = 4;

      frame 2:
      imgloader.contentPath = imgpath + imgname + extension;

      imgloader._alpha = alpha;

      frame 3:
      if (imgloader._alpha != 100) {
      alpha = alpha + 2;
      }

      nextb.OnRelease = function() {
      imgname = imgname + 1;
      }

      gotoAndPlay(2);

      I want to, whenever you press next (nextb), for it to load the next picture, named 2.JPG.
      Can anyone pleae help?

      Thanks, Hengy
        • 1. Re: parsing??
          kglad Adobe Community Professional & MVP
          try:

          • 2. Re: parsing??
            Hengy Level 1
            Thanks kglad , but I experimanted a little, and now I got some new code, which I still have some trouble with...

            Frame 1:
            imgloader.contentPath = "Photos/1.JPG";

            numimg = 15;

            var imgpath = "Photos/";
            var extension = ".JPG";
            var alpha = 0;

            varx = 0;
            var myArray = new Array();
            var i = 0;
            do {
            MyArray = imgpath+i+extension;
            i++;
            }
            while (i <= numimg);

            Frame 2:
            imgloader._alpha = alpha;

            Frame 3:
            if (imgloader._alpha != 100) {
            alpha = alpha + 2.5;
            }

            nextb.onRelease = function() {
            myProgressBar.mode = "manual";
            myProgressBar.setProgress(0, 100);
            varx = varx + 1;
            myProgressBar.mode = "polled";
            if (varx > numimg) {
            varx = varx - 1;
            }
            imgloader.contentPath = MyArray[varx];
            alpha = 0;
            gotoAndPlay(2);
            }

            prevb.onRelease = function() {
            myProgressBar.mode = "manual";
            myProgressBar.setProgress(0, 100);
            varx = varx - 1;
            myProgressBar.mode = "polled";
            if (varx < 0) {
            varx = varx + 1;
            }
            imgloader.contentPath = MyArray[varx];
            alpha = 0;
            gotoAndPlay(2);
            }

            gotoAndPlay(2);

            This is now what i have got. I am having trouble with the Array, I think. When I click next, it responds, but it only clears the first picture and resets the preloader back to 0. It doesn't load the new picture. This is also the case with the previous button.
            Any ideas?
            Thanks, Hengy
            • 3. Re: parsing??
              kglad Adobe Community Professional & MVP
              is your scrollPane on all three frames?

              is 1.JPG loading?

              (your test for first and last image isn't going to work the way you want.)

              and use the attach code option. among other things it prevents this forum from mangling your code, especially when you use [ i ].
              • 4. Re: parsing??
                Hengy Level 1
                Sorry about the code.
                I am not sure what you mean by scrollPane...
                And yes, 1.JPG does load.
                Thanks for your help, Hengy
                • 5. Re: parsing??
                  kglad Adobe Community Professional & MVP
                  post a link to your fla.
                  • 6. Re: parsing??
                    Hengy Level 1
                    ok. I am currently at school... I will post the link ASAP.
                    Thanks again for all the help! Hengy
                    • 7. Re: parsing??
                      Hengy Level 1
                      Here is the link to my flash. link
                      • 8. Re: parsing??
                        kglad Adobe Community Professional & MVP
                        file is corrupt and i'm unable to repair. see if you can unzip your file.
                        • 9. Re: parsing??
                          Hengy Level 1
                          Sorry. I wonder why that happened... I will post it again when I get home.

                          Hengy
                          • 10. Re: parsing??
                            Hengy Level 1
                            ok. Here is the file: Link And, if that one doesn't work... Link

                            Thanks for all your help!
                            Hengy
                            • 11. Re: parsing??
                              kglad Adobe Community Professional & MVP
                              myArray is not the same as MyArray. if you want to use MyArray you need to spell the name correctly in your initialization statement in frame 1 of your fla.
                              • 12. Re: parsing??
                                Hengy Level 1
                                That worked! I don't know how I missed that... I guess the lesson here is to be more careful. Thanks kglad!
                                Hengy
                                • 13. Re: parsing??
                                  kglad Adobe Community Professional & MVP
                                  you're welcome.

                                  p.s. learn to use the trace() function to help track problems.