19 Replies Latest reply on Dec 14, 2011 4:20 PM by kglad

    thumbnails problems

    melas076 Level 1

      dear all,

       

      I would like to know if you could tell me how to solve this issue for thumbnails.

       

      I want the 4th thumbnails will be on the second line and not on the 1st line....

       

      i will appreciate your help!

      Regards,

      MELAS

       

      this is my code :

       

      stop();

       

      function loadXML(loaded) {

       

      if (loaded) {

       

      xmlData = this.firstChild;

      links = [];

      description = [];

      thumbnails = [];

      a =[];

      total = xmlData.firstChild.childNodes.length;

      for (i=0; i<total; i++) {

       

      links[i] = xmlData.firstChild.childNodes[i].attributes.datas;

      description[i] = xmlData.firstChild.childNodes[i].attributes.label;

      thumbnails[i] = xmlData.firstChild.childNodes[i].attributes.thumbs;

      a[i] = xmlData.firstChild.childNodes[i].attributes.folder;

      thumbnails_fn(i);

      initPreloading();

      }

      //firstImage();

       

      } else {

       

      content = "file not loaded!";

       

      }

      }

       

      xmlData = new XML();

      xmlData.ignoreWhite = true;

      xmlData.onLoad = loadXML;

      xmlData.load("data.xml");

       

       

      function thumbnails_fn(k) {

       

      var bb = xmlData.firstChild.childNodes[k].attributes.label;

      this.thumbnail_mc.createEmptyMovieClip("t"+k, this.thumbnail_mc.getNextHighestDepth());

      this.thumbnail_mc._quality = "BEST";

      thumbnail_mc.createTextField("title_txt"+k, thumbnail_mc.getNextHighestDepth(), 0, -30, 150, 20);

      //thumbnail_mc["title_txt"+k].border = true;

      thumbnail_mc["title_txt"+k]._x = (thumbnail_mc["title_txt"+k]._width+40)*k ;

      thumbnail_mc["title_txt"+k].setNewTextFormat(txt_fmt);

      thumbnail_mc["title_txt"+k].text = bb ;

      tlistener = new Object();

      tlistener.onLoadInit = function(target_mc) {

      target_mc._x = (eval("this.thumbnail_mc.t"+k)._width+40)*k;

      target_mc.pictureValue = k;

      trace(k);

       

      target_mc.onRelease = function() {

      aa = xmlData.firstChild.childNodes[k].attributes.datas;

      getURL("javascript:launch('"+aa+"')");

      };

      target_mc.onRollOver = function() {

      this._alpha = 100;

      //this._width =;

      };

      target_mc.onRollOut = function() {

       

      this._alpha = 80;

       

      };

       

      };

      image_mcl = new MovieClipLoader();

      image_mcl.addListener(tlistener);

      image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);

       

       

      }

      LOADmc._x=(alignmc.width-LOADmc._width);

      LOADmc._y=(alignmc.height-LOADmc._height);

        • 1. Re: thumbnails problems
          kglad Adobe Community Professional & MVP

          you want every 4th thumbnail on a 2nd line below the first line?

          • 2. Re: thumbnails problems
            melas076 Level 1

            yes, i want every 4th thumbnail on new line below the previous line......

            • 3. Re: thumbnails problems
              kglad Adobe Community Professional & MVP

              so, all thumbnails are on line 1 except every 4th which appear below the previous lowest line?  ie, if you have 12 thumbnails, you'll have 4 lines, correct?

               

              and, you want every 4 thumbnail to be at the far-left?

              • 4. Re: thumbnails problems
                melas076 Level 1

                so, all thumbnails are on line 1 except every 4th which appear below the previous lowest line?  ie, if you have 12 thumbnails, you'll have 4 lines, correct? yes correct....

                • 5. Re: thumbnails problems
                  kglad Adobe Community Professional & MVP

                  :

                   

                  function thumbnails_fn(k) {

                   

                  var bb = xmlData.firstChild.childNodes[k].attributes.label;

                  this.thumbnail_mc.createEmptyMovieClip("t"+k, this.thumbnail_mc.getNextHighestDepth());

                  this.thumbnail_mc._quality = "BEST";

                  thumbnail_mc.createTextField("title_txt"+k, thumbnail_mc.getNextHighestDepth(), 0, -30, 150, 20);

                  //thumbnail_mc["title_txt"+k].border = true;

                  thumbnail_mc["title_txt"+k]._x = (thumbnail_mc["title_txt"+k]._width+40)*k ;

                  if(k%4==3){

                  thumbnail_mc["title_txt"+k]._x=0;  // if you want far-left for every 4th

                  var gapY:Number = thumbnail_mc["title_txt"+k]._height+40;

                  thumbnail_mc["title_txt"+k]._y=gapY*Math.ceil(k/4);

                  }

                  var gapY:Number =

                  thumbnail_mc["title_txt"+k].setNewTextFormat(txt_fmt);

                  thumbnail_mc["title_txt"+k].text = bb ;

                  tlistener = new Object();

                  tlistener.onLoadInit = function(target_mc) {

                  target_mc._x = (eval("this.thumbnail_mc.t"+k)._width+40)*k;

                  target_mc.pictureValue = k;

                  trace(k);

                   

                  target_mc.onRelease = function() {

                  aa = xmlData.firstChild.childNodes[k].attributes.datas;

                  getURL("javascript:launch('"+aa+"')");

                  };

                  target_mc.onRollOver = function() {

                  this._alpha = 100;

                  //this._width =;

                  };

                  target_mc.onRollOut = function() {

                   

                  this._alpha = 80;

                   

                  };

                   

                  };

                  1 person found this helpful
                  • 6. Re: thumbnails problems
                    melas076 Level 1

                    i put on my code and tried but the image is still on the 1st line.

                    but the text title is on the 2nd line

                    • 7. Re: thumbnails problems
                      kglad Adobe Community Professional & MVP

                      use:

                       

                      var tlistener:Object = new Object();

                      var image_mcl:MovieClipLoader = new MovieClipLoader();

                      image_mcl.addListener(tlistener);

                       

                      function thumbnails_fn(k) {

                       

                      var bb = xmlData.firstChild.childNodes[k].attributes.label;

                      var mc:MovieClip=this.thumbnail_mc.createEmptyMovieClip("t"+k, this.thumbnail_mc.getNextHighestDepth());

                      mc.kvar=k;

                      var target_mc:MovieClip=mc.createEmptyMovieClip("target",0);

                      this.thumbnail_mc._quality = "BEST";

                      thumbnail_mc.createTextField("title_txt"+k, thumbnail_mc.getNextHighestDepth(), 0, -30, 150, 20);

                      //thumbnail_mc["title_txt"+k].border = true;

                      thumbnail_mc["title_txt"+k]._x = (thumbnail_mc["title_txt"+k]._width+40)*k ;

                      thumbnail_mc["title_txt"+k].setNewTextFormat(txt_fmt);

                      thumbnail_mc["title_txt"+k].text = bb ;

                      image_mcl.loadClip(thumbnails[k], target_mc);

                      }

                       

                      tlistener.onLoadInit = function(target_mc) {

                      target_mc._x = target_mc._width+40)*target_mc.kvar;

                      if(target_mc._parent.kvar%4==3){

                      target_mc._x=0;  // if you want far-left for every 4th

                      var gapY:Number = target_mc._height+40;

                      target_mc._y=gapY*Math.ceil(target_mc._parent.kvar/4);

                      }

                      trace(target_mc._parent.kvar);

                       

                      target_mc.onRelease = function() {

                      aa = xmlData.firstChild.childNodes[this._parent.kvar].attributes.datas;

                      getURL("javascript:launch('"+aa+"')");

                      };

                      target_mc.onRollOver = function() {

                      this._alpha = 100;

                      //this._width =;

                      };

                      target_mc.onRollOut = function() {

                       

                      this._alpha = 80;

                       

                      };

                      }

                      • 8. Re: thumbnails problems
                        melas076 Level 1

                        now, it is titles are in the 1st line.

                        and only 2 pictures are in the 1st and 2nd line.

                         

                        • 9. Re: thumbnails problems
                          kglad Adobe Community Professional & MVP

                          what's the trace output and what's the value of total?

                          • 10. Re: thumbnails problems
                            melas076 Level 1

                            how to do that?

                            • 11. Re: thumbnails problems
                              kglad Adobe Community Professional & MVP

                              you have a trace():

                               

                              trace(target_mc._parent.kvar);

                               

                              that should cause output in your output panel.  do you see any output when you test?

                              • 12. Re: thumbnails problems
                                melas076 Level 1

                                yes i see the output and see in below :

                                 

                                3

                                2

                                1

                                0

                                 

                                what can i do else?

                                • 13. Re: thumbnails problems
                                  kglad Adobe Community Professional & MVP

                                  and what's the value of total? (use the trace function.)

                                  • 14. Re: thumbnails problems
                                    melas076 Level 1

                                    it gives me only this:

                                     

                                    3

                                    2

                                    1

                                    0

                                    • 15. Re: thumbnails problems
                                      melas076 Level 1

                                      can you verifiy if it is correct that i did or not?

                                       

                                      but it works well that i see !

                                       

                                      stop();

                                       

                                      function loadXML(loaded) {

                                       

                                      if (loaded) {

                                       

                                      xmlData = this.firstChild;

                                      links = [];

                                      description = [];

                                      thumbnails = [];

                                      a =[];

                                      total = xmlData.firstChild.childNodes.length;

                                      for (i=0; i<total; i++) {

                                       

                                      links[i] = xmlData.firstChild.childNodes[i].attributes.datas;

                                      description[i] = xmlData.firstChild.childNodes[i].attributes.label;

                                      thumbnails[i] = xmlData.firstChild.childNodes[i].attributes.thumbs;

                                      a[i] = xmlData.firstChild.childNodes[i].attributes.folder;

                                      thumbnails_fn(i);

                                      initPreloading();

                                      }

                                      //firstImage();

                                       

                                      } else {

                                       

                                      content = "file not loaded!";

                                       

                                      }

                                      }

                                       

                                      xmlData = new XML();

                                      xmlData.ignoreWhite = true;

                                      xmlData.onLoad = loadXML;

                                      xmlData.load("data.xml");

                                       

                                      function thumbnails_fn(k) {

                                       

                                      var bb = xmlData.firstChild.childNodes[k].attributes.label;

                                      this.thumbnail_mc.createEmptyMovieClip("t"+k, this.thumbnail_mc.getNextHighestDepth());

                                      this.thumbnail_mc._quality = "BEST";

                                      thumbnail_mc.createTextField("title_txt"+k, thumbnail_mc.getNextHighestDepth(), 0, -30, 150, 20);

                                      //thumbnail_mc["title_txt"+k].border = true;

                                      thumbnail_mc["title_txt"+k]._x = (thumbnail_mc["title_txt"+k]._width+40)*k ;

                                      thumbnail_mc["title_txt"+k].setNewTextFormat(txt_fmt);

                                      thumbnail_mc["title_txt"+k].text = bb ;

                                       

                                      if(k%4==3){

                                      thumbnail_mc["title_txt"+k]._x=0;  // if you want far-left for every 4th

                                      var gapY:Number = thumbnail_mc["title_txt"+k]._height+100;

                                      thumbnail_mc["title_txt"+k]._y=gapY*Math.ceil(k/4);

                                      }

                                       

                                      var gapY:Number =

                                      thumbnail_mc["title_txt"+k].setNewTextFormat(txt_fmt);

                                      thumbnail_mc["title_txt"+k].text = bb ;

                                       

                                       

                                       

                                      tlistener = new Object();

                                      tlistener.onLoadInit = function(target_mc) {

                                      target_mc._alpha = 80;

                                      target_mc._x = (eval("this.thumbnail_mc.t"+k)._width+40)*k;

                                      target_mc.pictureValue = k;

                                      if(k%4==3){

                                      target_mc._x=0;  // if you want far-left for every 4th

                                      var gapY:Number = target_mc._height+30;

                                      target_mc._y=gapY*Math.ceil(k/4);

                                      }

                                      trace(k);

                                       

                                       

                                       

                                      target_mc.onRelease = function() {

                                      aa = xmlData.firstChild.childNodes[k].attributes.datas;

                                      getURL("javascript:launch('"+aa+"')");

                                      };

                                       

                                      target_mc.onRollOver = function() {

                                      this._alpha = 100;

                                      this._xscale *= 1.2;

                                      this._yscale *= 1.2;

                                      this._quality = "BEST";

                                      };

                                       

                                      target_mc.onRollOut = function() {

                                      this._alpha = 80;

                                      this._width = 150;

                                      this._height = 113;

                                       

                                      };

                                      };

                                       

                                      image_mcl = new MovieClipLoader();

                                      image_mcl.addListener(tlistener);

                                      image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);

                                       

                                      }

                                       

                                      LOADmc._x=(alignmc.width-LOADmc._width);

                                      LOADmc._y=(alignmc.height-LOADmc._height);

                                      • 16. Re: thumbnails problems
                                        kglad Adobe Community Professional & MVP

                                        what's the trace output using:

                                         

                                         

                                         

                                        stop();

                                         

                                        function loadXML(loaded) {

                                         

                                        if (loaded) {

                                         

                                        xmlData = this.firstChild;

                                        links = [];

                                        description = [];

                                        thumbnails = [];

                                        a =[];

                                        total = xmlData.firstChild.childNodes.length;

                                        trace("total "+total);

                                        for (i=0; i<total; i++) {

                                         

                                        links[i] = xmlData.firstChild.childNodes[i].attributes.datas;

                                        description[i] = xmlData.firstChild.childNodes[i].attributes.label;

                                        thumbnails[i] = xmlData.firstChild.childNodes[i].attributes.thumbs;

                                        a[i] = xmlData.firstChild.childNodes[i].attributes.folder;

                                        thumbnails_fn(i);

                                        initPreloading();

                                        }

                                        //firstImage();

                                         

                                        } else {

                                         

                                        content = "file not loaded!";

                                         

                                        }

                                        }

                                         

                                        xmlData = new XML();

                                        xmlData.ignoreWhite = true;

                                        xmlData.onLoad = loadXML;

                                        xmlData.load("data.xml");

                                         

                                        function thumbnails_fn(k) {

                                         

                                        var bb = xmlData.firstChild.childNodes[k].attributes.label;

                                        this.thumbnail_mc.createEmptyMovieClip("t"+k, this.thumbnail_mc.getNextHighestDepth());

                                        this.thumbnail_mc._quality = "BEST";

                                        thumbnail_mc.createTextField("title_txt"+k, thumbnail_mc.getNextHighestDepth(), 0, -30, 150, 20);

                                        //thumbnail_mc["title_txt"+k].border = true;

                                        thumbnail_mc["title_txt"+k]._x = (thumbnail_mc["title_txt"+k]._width+40)*k ;

                                        thumbnail_mc["title_txt"+k].setNewTextFormat(txt_fmt);

                                        thumbnail_mc["title_txt"+k].text = bb ;

                                         

                                        if(k%4==3){

                                        thumbnail_mc["title_txt"+k]._x=0;  // if you want far-left for every 4th

                                        var gapY:Number = thumbnail_mc["title_txt"+k]._height+100;

                                        thumbnail_mc["title_txt"+k]._y=gapY*Math.ceil(k/4);

                                        }

                                         

                                        var gapY:Number =

                                        thumbnail_mc["title_txt"+k].setNewTextFormat(txt_fmt);

                                        thumbnail_mc["title_txt"+k].text = bb ;

                                         

                                         

                                         

                                        tlistener = new Object();

                                        tlistener.onLoadInit = function(target_mc) {

                                        target_mc._alpha = 80;

                                        target_mc._x = (eval("this.thumbnail_mc.t"+k)._width+40)*k;

                                        target_mc.pictureValue = k;

                                        if(k%4==3){

                                        target_mc._x=0;  // if you want far-left for every 4th

                                        var gapY:Number = target_mc._height+30;

                                        target_mc._y=gapY*Math.ceil(k/4);

                                        }

                                        trace(k);

                                         

                                         

                                         

                                        target_mc.onRelease = function() {

                                        aa = xmlData.firstChild.childNodes[k].attributes.datas;

                                        getURL("javascript:launch('"+aa+"')");

                                        };

                                         

                                        target_mc.onRollOver = function() {

                                        this._alpha = 100;

                                        this._xscale *= 1.2;

                                        this._yscale *= 1.2;

                                        this._quality = "BEST";

                                        };

                                         

                                        target_mc.onRollOut = function() {

                                        this._alpha = 80;

                                        this._width = 150;

                                        this._height = 113;

                                         

                                        };

                                        };

                                         

                                        image_mcl = new MovieClipLoader();

                                        image_mcl.addListener(tlistener);

                                        image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);

                                         

                                        }

                                         

                                        LOADmc._x=(alignmc.width-LOADmc._width);

                                        LOADmc._y=(alignmc.height-LOADmc._height);

                                        1 person found this helpful
                                        • 17. Re: thumbnails problems
                                          melas076 Level 1

                                          it gives me this : total 4

                                          • 18. Re: thumbnails problems
                                            kglad Adobe Community Professional & MVP

                                            ok, so you should see 3 items on the first line and the 4th item below those 3.  is that what you see?

                                            1 person found this helpful