4 Replies Latest reply on May 17, 2007 2:47 PM by

    AS for thumbnail to load big size photograph on click

      Hello,
      I have a webpage with about 6 thumbnails. I would like flash to upload full size photographs, when viewer clicks on those thumbnails. Could anyone tell me, how is it done?
      First of all, where are those photographs stored. Are they on the same server as my website? And should they be just simple jpegs on its own or should they be embeded on independent page.html?
      And finally, what is the AS for this?

      Would it be something like this?
      Let's say I would put jpeg on the same server as mysite and name it photo1.jpeg

      on(release){
      getURL(" http://www.mysite.com/photo1.jpeg");
      }

      thank you so much for your help.
      Janek
        • 1. Re: AS for thumbnail to load big size photograph on click
          breez11
          on(release){
          container.loadMovie(" http://www.mysite.com/photo1.jpeg");
          }

          or

          on(release){
          loadMovie(" http://www.mysite.com/photo1.jpeg", "container");
          }

          since it is large though wouldbe better to use loadClip if you are exporting with flash 7 or later


          bar._visible = false;
          border._visible = false;
          this.createEmptyMovieClip("container", "100");
          my_mc = new MovieClipLoader();
          preload = new Object();
          my_mc.addListener(preload);
          preload.onLoadStart = function(targetMC) {

          trace("started loading "+targetMC);
          container._visible = false;
          bar._visible = true;
          border._visible = true;
          pText._visible = true;

          };
          preload.onLoadProgress = function(targetMC, lBytes, tBytes) {

          bar._width = (lBytes/tBytes)*100;
          pText.text = "% "+Math.round((lBytes/tBytes)*100);

          };
          preload.onLoadComplete = function(targetMC) {

          container._visible = true;
          border._visible = false;
          bar._visible = false;
          pText._visible = false;
          trace(targetMC+" finished");

          };
          //default image
          my_mc.loadClip("picture1.jpg", "container");
          //buttons
          button1.onPress = function() {

          my_mc.loadClip("picture1.jpg", "container");

          };
          button2.onPress = function() {

          my_mc.loadClip("picture2.jpg", "container");

          };
          button3.onPress = function() {

          my_mc.loadClip("picture3.jpg", "container");

          };

          • 2. Re: AS for thumbnail to load big size photograph on click
            Hello Breez,
            thank you so much for your response. It is quite overwhelming, how complex the AS could be. I have a few questions, if I may, but please keep in mind, that I am complete beginner, so stuff you consider basic is unknown territory for me.
            I will consider to work with the second AS you gave me, since it is the most simple at this point.

            on(release) {
            loadMovie(" http://www.mysite.com/photo1.jpg", "container");
            }

            I assume, that this AS will be assigned to a Button.
            First of all, what is "container"? Is it that background, kinda of mini web page the photo1.jpg is embeded on? Or what exactly is it? And if I assign this AS to the button, how do I "prepare" that container with that photo1.jpg? Is it only simple jpeg placed on www.mysite.com, or do I need to somehow prepare it for Flash to be able to read it?

            Thank you so much for you help
            Janek
            • 3. AS for thumbnail to load big size photograph on click
              sly one Level 1
              You can only load images into MovieClips. breez11's code assumes you have a MovieClip on Stage with the instance name of "container".

              Also...you should get out of the habit of placing button code on top of buttons, but instead place it in the first Frame of your main Timeline. Then the code would look like this:

              //-----my_btn is the instance name of your button----
              my_btn.onRelease = function():Void {
              container.loadMovie(" http://www.mysite.com/photo1.jpg");
              }


              Ideally you want to use MovieClipLoader to load images, since it gives you a quick way to track loading (and display progress bars etc). But it's even more complicated to learn that loadMovie.

              Read about it here: http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?cont ext=Flash_MX_2004&file=00001577.html
              1 person found this helpful
              • 4. Re: AS for thumbnail to load big size photograph on click
                Hello Sly,
                thanks for trying to help me, I know it is tough to explain something such basic to someone who has no idea.
                So thank you for your patience. So now I know, that I need to place a Movie clip to the stage. I assume you mean Movie Clip symbol? OK, so I will create a new Movie Symbol, and name it container. I leave it empty and put it as another layer on the stage. But where do I place it? Somewhere in the middle, over other elements of that web page? That web page is already full of other stuff. How do I make it invisible? Ideally, what I would like to achieve is basically (by clicking on that button) to open new window, which would be some nice backgroung with that picture ebmeded on it. This window would kind of float independently (not to be part of that web page) and viewer could close it after viewing)
                Sorry for being such a dummy, but I just can't get it.
                Thanks a lot,
                Janek