9 Replies Latest reply on Oct 21, 2009 10:36 AM by kglad

    thumbnails sizing issue on xml gallery


      Hello everybody!

      I'm finding myself in a big trouble with a script, i really hope you can help me out in solving it.

      I downloaded and succesfully installed the following script:


      It's an xml-driven flash gallery, with thumbnails on the bottom and bigger image above, very simple.

      As you will see by testing the files included in the zip, all thumbnails have actually the same size, that's because the images contained in the "images" directory (which are then called by the xml file) are all of the same size (730 x 450 pixels).

      The problems: if i add a differently-sized image (let's say, 300x500), its thumbnail does not equal the others in size, that's because the original images are scaled of a certain percentage...

      My aim is, instead of using the scaling, to get each and every thumbnails of the same dimension (70x70 pixel), whatever the original image dimension is. How can i modify the script to suit my needs?

      I'd like to kind of eliminate the scaling concept behind this script so that i can be able to set fixed pixel values to thumbnails, and possibly (this would be a very appreciated plus), to specify the maximum size of the bigger image, so that i can get some kind of a graphic uniformity with no oversizing the stage.

      I hope i explained well my problem and i'm sorry in advance for my poor english... if there's something unclear about my help request, please let me know and i'll try to be more clear... but i'm 100% sure you will quickly find out what i mean by simply testing the script after adding an image of different size (than 730x450) in the "images" directory and, by the way, updating the xml file.

      I thank you so much for all the help you will eventually give me, i really appreciate your help! :-)

      Bye bye!


        • 1. Re: thumbnails sizing issue on xml gallery
          kglad Adobe Community Professional & MVP

          you're more likely to receive help if you post (only) the code related to thumbnail sizing.

          • 2. Re: thumbnails sizing issue on xml gallery
            lvciccone Level 1

            ops... i'm sorry...

            here's the code, i hope it will come out well formatted...


            (note for anyone download the zip file: the following code is featured on the "barra" movieclip and it's the code behind more functionalities than only the one about the scaling of the miniatures... that's why i decided to post it entirely, i hope it's ok this way... )


            -------- start of the code ---------


            // imposta a false se non vuoi la descrizione
            descriptions = false;
            // box descrizione invisibile
            alert._visible = false;
            // effetto ease
            var ease = 5;
            //imposto la scala della foto grande
            _root.scala_x = 100;
            _root.scala_y = 100;
            //imposto la barra visibile
            _root.barra_stato = "true";
            _root.box.useHandCursor = false;
            //leggo i dati XML
            thumbs = new XML();
            thumbs.ignoreWhite = true;
            // qui inserire il percorso al file .XML
            thumbs.onLoad = function() {
                 root = this.firstChild;
                 total = root.childNodes.length;
                 displayNum = Number(root.childNodes[0].attributes.displayNum);
                 separation = Number(root.childNodes[0].attributes.separation);
                 w = 86.3;
                 h = 70;
                 mask._width = displayNum*(w+separation);
                 mask._height = h+30;
                 forward._x = mask._width+12;
                 forward._y = back._y=h/2;
                 mcs = [];
                 for (i=0; i<total; i++) {
                      newThumb = thumbnailer.container.duplicateMovieClip("container"+i, i);
                      with (newThumb) {
                           _x = (w+separation)*i;
                           preloader._x = w/2;
                           preloader._y = h/2;
                           shape._width = w;
                           shape._height = h;
                      var image = root.childNodes[i].childNodes[0].firstChild.nodeValue;
                      var image1 = root.childNodes[0].childNodes[0].firstChild.nodeValue;
                      newThumb.image = root.childNodes[i].childNodes[0].firstChild.nodeValue;
                      newThumb.link = root.childNodes[i].childNodes[2].firstChild.nodeValue;
                      // carico la prima foto
                      _root.box._xscale = _root.scala_x;
                      // scalo la larghezza
                      _root.box._yscale = _root.scala_y;
                      // scalo l'altezza
                      //carico le thumbs e le scalo
                      newThumb.cont._xscale = 13.8;
                      // scalo la larghezza
                      newThumb.cont._yscale = 18.4;
                      newThumb.onRelease = function() {
                           loadMovie(this.image, _root.holder_gallery_bassa.box.foto_effetto);
                           _root.varimmagine = this.image;
                           // carico l'immagine nel clip effetto
                           // avvio il box
                           _root.holder_gallery_bassa.box._xscale = _root.scala_x;
                           // scalo la larghezza
                           _root.holder_gallery_bassa.box._yscale = _root.scala_y;
                           // scalo l'altezza
                      newThumb.onReleaseOutside = function() {
                           this._xscale = 100;
                           this._yscale = 100;
                           this._y = this._y+10;
                           this._x = this._x+5;
                 var offset = total-1;
                 var dest = 0;
                 var increment = w+separation;
                 var ending = (total-displayNum)*(w+separation);
                 var lastmc = total-1;
                 var firstmc = 0;
                 back.onRelease = function() {
                      if (dest<0) {
                           dest += increment;
                      } else {
                           first = mcs[0];
                           for (k=0; k<total; k++) {
                                mcs[k] = mcs[k+1];
                           mcs[total-1] = first;
                           thumbnailer["container"+lastmc]._x = -(w+separation);
                           firstmc = lastmc;
                           //check whos new lastmc
                           for (k=0; k<total; k++) {
                                if (mcs[k] == (total-1)) {
                                     lastmc = k;
                 forward.onRelease = function() {
                      if (dest>-ending) {
                           dest -= increment;
                      } else {
                           last = mcs[total-1];
                           for (k=1; k<total; k++) {
                                mcs[total-k] = mcs[total-k-1];
                           mcs[0] = last;
                           thumbnailer["container"+firstmc]._x = (displayNum)*(w+separation);
                           lastmc = firstmc;
                           //check whos new firstmc
                           for (k=0; k<total; k++) {
                                if (mcs[k] == 0) {
                                     firstmc = k;
                 onEnterFrame = function () {
                      for (j=0; j<total; j++) {
                           thumbnailer["container"+j]._x += (dest+(mcs[j])*(w+separation)-thumbnailer["container"+j]._x)/ease;
                      alert._x = _xmouse;
                      alert._y = _ymouse;


            -------- end of the code ---------

            thank you again!



            • 3. Re: thumbnails sizing issue on xml gallery
              kglad Adobe Community Professional & MVP



               //carico le thumbs e le scalo
                        newThumb.cont._xsca le = 13.8;
                        // scalo la larghezza
                        newThumb.cont._ysca le = 18.4;


              • 4. Re: thumbnails sizing issue on xml gallery
                lvciccone Level 1

                already tried that one, the result is that the thumbnails shows a 70x70 mask of the upper left area of each original image...

                unfortunately no image resizing to 70x70...

                i hope i explained well the result that i get, i think it should be easier for you to look at the original files on the zip (and testing its FLA file) to get a better idea of the result that i get after making the editing you suggested... not forcing anyone, just suggesting in order to avoid misunderstanding that may come out as my english may not be fully understandable...

                • 5. Re: thumbnails sizing issue on xml gallery
                  kglad Adobe Community Professional & MVP

                  you'll need to resize newThumb.cont after loading is complete.

                  • 6. Re: thumbnails sizing issue on xml gallery
                    lvciccone Level 1

                    the thing is that all thumbnails will appear once the preloading of all the original images has finished, means that the loading is (supposed to be) already completed... if you look at the preloading code (first keyframe on root) you will see it, here it is:



                    _root.onEnterFrame = function() {
                     if (_root.box.getBytesLoaded()>10 && _root.box.getBytesLoaded()>=_root.box.getBytesTotal()) {
                      _root.box._x = Stage.width/2-(_root.box._width/2);
                      _root.box._y = Stage.height/2-(_root.box._height/2);
                    Stage.showMenu = false;
                    quality = "BEST";


                    the above code centers the first bigger image on the stage after all images are preloaded, this means that when thumbs code is called (inside the "barra" movieclip), the preloading have already completed.


                    anyway, have you tried downloading the zip file? i think you would have a clearer vision of what the problem is...


                    please let me know... thank you very much for your help!



                    • 7. Re: thumbnails sizing issue on xml gallery
                      kglad Adobe Community Professional & MVP

                      sizing of newThumb must occur after



                      completes loading, whether image is preloaded or not.


                      p.s.  i generally don't download and correct files unless i'm hired.

                      • 8. Re: thumbnails sizing issue on xml gallery
                        lvciccone Level 1




                        is this what you meant?


                        and... about the "hiring" thing... well...  just don't understand... is this a help forum or what? i kindly asked (you and everyone else) for a help and i simply thought that by downloading that zip you (and everyone else) could have had a more clearer vision of what the problem is... i suggest that way to make things easier for you (and everyone else).

                        i know time is money... if you don't have time for me, then just don't reply, and i will patiently wait for someone else's help (for free, as i don't have money to hire anyone...).

                        thanks, bye.


                        • 9. Re: thumbnails sizing issue on xml gallery
                          kglad Adobe Community Professional & MVP



                          loading still takes time, even if the object is preloaded.  you'll need to use preloader code or the onLoadInit() method of the movieclip loader class listener.