4 Replies Latest reply on Sep 21, 2009 12:00 AM by Sreelash

    issue with thumbnails

    Sreelash Level 1

      Hi,

       

                I have implemented a thumbnail. Then when I click on the thumbnail images, i want to create a popup window in flash. But the problem here is that no action is performing when i click on the thumbnails. Then code that i hve used for this purpose is attached below. Can anybody help me?

       

      function createThumbnails(xml,MC){
          var totThmbs = xml.firstChild.childNodes.length;
          var Hldr = MC.createEmptyMovieClip("Hldr",200);
          Hldr.attachMovie("thumbnail_bg","thumbnail_bg",100);
          Hldr._y = 235;
         
          var thumbnailHldr = Hldr.createEmptyMovieClip("thumbnailHldr",102);
          thumbnailHldr._x = 35;
          thumbnailHldr._y = 24;
          var maskMc = Hldr.createEmptyMovieClip("maskMc",101);
          drawRect(maskMc,0xFF00FF,100,35,24,416,107);
          thumbnailHldr.setMask(maskMc);
         
          Hldr.thumbnail_bg.next.onPress = function(){
              Next(thumbnailHldr,Hldr,maskMc);
          }
          Hldr.thumbnail_bg.prev.onPress = function(){
              Previous(thumbnailHldr,Hldr,maskMc);
          }
         
          for(var i=0;i<totThmbs;i++){   
              thumbId = (xml.firstChild.childNodes[i].firstChild).toString();
             var thmbCont = thumbnailHldr.createEmptyMovieClip("thmbCont"+i,i);
              var _thumb = thmbCont.createEmptyMovieClip("_thumb",11);
              _thumb.name = i;

             
              thmbCont._thumb.onPress = function(){
                  trace("gd")
              }

             
              var loadListener:Object = new Object();
              var ImgLoader:MovieClipLoader = new MovieClipLoader();
              ImgLoader.addListener(loadListener);       
              ImgLoader.loadClip(thumbId,_thumb);       
             
              loadListener.onLoadInit = function(target_mc:MovieClip) {
                  target_mc._x = XPos;
                  XPos = XPos + target_mc._width+15;
                  extendLen = thumbnailHldr._width - maskMc._width;
                  leftPos = -1 * extendLen;
              };
          }
         
      }

       

       

      The portion of code that i have used for thumbnail image identification is kept as bold letters. Please help me.

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

          your onPress code is lost when you start loading into your thumbnail.  try:

           


           

          function createThumbnails(xml,MC){
              var totThmbs = xml.firstChild.childNodes.length;
              var Hldr = MC.createEmptyMovieClip("Hldr",200);
              Hldr.attachMovie("thumbnail_bg","thumbnail_bg",100);
              Hldr._y = 235;
             
              var thumbnailHldr = Hldr.createEmptyMovieClip("thumbnailHldr",102);
              thumbnailHldr._x = 35;
              thumbnailHldr._y = 24;
              var maskMc = Hldr.createEmptyMovieClip("maskMc",101);
              drawRect(maskMc,0xFF00FF,100,35,24,416,107);
              thumbnailHldr.setMask(maskMc);
             
              Hldr.thumbnail_bg.next.onPress = function(){
                  Next(thumbnailHldr,Hldr,maskMc);
              }
              Hldr.thumbnail_bg.prev.onPress = function(){
                  Previous(thumbnailHldr,Hldr,maskMc);
              }
             
              for(var i=0;i<totThmbs;i++){   
                  thumbId = (xml.firstChild.childNodes[i].firstChild).toString();
                 var thmbCont = thumbnailHldr.createEmptyMovieClip("thmbCont"+i,i);
                  var _thumb = thmbCont.createEmptyMovieClip("_thumb",11);
                  thmbCont.name = i;

                 
                  thmbCont.onPress = function(){
                      trace("gd "+this.name)
                  }

                 
                  var loadListener:Object = new Object();
                  var ImgLoader:MovieClipLoader = new MovieClipLoader();
                  ImgLoader.addListener(loadListener);       
                  ImgLoader.loadClip(thumbId,_thumb);       
                 
                  loadListener.onLoadInit = function(target_mc:MovieClip) {
                      target_mc._x = XPos;
                      XPos = XPos + target_mc._width+15;
                      extendLen = thumbnailHldr._width - maskMc._width;
                      leftPos = -1 * extendLen;
                  };
              }
             
          }

           

           

           

          • 2. Re: issue with thumbnails
            Sreelash Level 1

            Hi kglad,

                      It's working now. Thank you very much. I had also put another thread with Subject as "Next and Previous for thumbnails". I didnt get an exact solution for it. Can you help me for solving this. If you want to c the code, please tell me, I ll post. I think its a big blunder. Thants why i didnt include it along with this thread.

             

            Thanks and Regards,

                                      Sreelash

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

              you're welcome.

               

              if you're able, please mark this thread as answered.

              • 4. Re: issue with thumbnails
                Sreelash Level 1

                Hi kglad,

                           I have marked it as corect answer. Can you help me to find a solution regarding Next and Previous functionality of thumbnails.

                 

                Regards,

                        Sreelash