7 Replies Latest reply on Jan 21, 2008 6:05 AM by robdillon

    Help with LoadMvoie

      I'm trying to build a dynamic XML/Flash gallery and I'm running into some problems. I am loading in larger images of thumbnails when the corresponding buttons are hit. That is all working perfectly. What I want to do though, is have a transition play and then the large photo to load only after the transition movie has finished. Currently the transition plays, but the photo loads at the same time on top.

      Example: http://dev.stoneig.com/port/stone-portfolio.html

      Here is the corresponding code where picunder_mc is the transition movie.
      Please help! Thanks!

      this.onEnterFrame = function() {
      filesize = picture.getBytesTotal();
      loaded = picture.getBytesLoaded();
      //preloader._visible = true;
      if (loaded != filesize) {
      //preloader.preload_bar._xscale = 100*loaded/filesize;
      } else {
      //preloader._visible = false;
      if (picture._alpha<100) {
      picture._alpha += 10;

      for (t=0; t<49; t++) {
      button = this["bt"+(t+1)];
      function addEvents(btn, id) {

      btn.onRelease = function() {
      if (loaded == filesize) {
      picture._alpha = 0;
      released = 1;
      prev_mc.prev_bt.onRelease = function() {
      if (id != 0) {
      if (loaded == filesize) {
      picture._alpha = 0;
      id = id-1;


      next_mc.next_bt.onRelease = function() {
      if (id != 48) {
      if (loaded == filesize) {
      picture._alpha = 0;
      id = id+1;


        • 1. Re: Help with LoadMvoie
          robdillon Most Valuable Participant
          Hi Audrey,

          If I understand you correctly, when the user clicks on a thumbnail, you want a larger image to download, and when the download has completed, you want a movieClip to play. When that movieClip finishes, you want the loaded clip to show.

          This is pretty much what I'm seeing happening. When I click on a thumbnail a second time, the larger image appears immediately because its already loaded. So there's no transition play.

          There's a lot that can be done to improve your code, but there is too much that's unexplained about your code example to give you a more specific solution.
          • 2. Re: Help with LoadMvoie
            AudreyWalker1 Level 1
            Hey Rob,

            It works almost as I like it - the loading is fine. The problem is I want everything consistent. Thus I want the gray background to transition in - then when it's finished, I want the large image to display. Once the image has been loaded in once, the transition is hidden, and that's what I want to try to fix.

            Would it help if I include the FLA?
            • 4. Re: Help with LoadMvoie
              AudreyWalker1 Level 1
              Thanks - I just sent you a link to the fla via private message
              • 5. Re: Help with LoadMvoie
                robdillon Most Valuable Participant
                I looked over the two movies that you sent. I have one suggestion for the first, change the loaded success clause to look like this:

                if (percent>=100) {
                // move this to last
                delete this.onEnterFrame;


                You want to delete the function as the last thing, not the first.

                For the second movie, you have a function that is building your mouse events for the thumbnails. You are calling to load in the larger image in the onRelease() function for each thumbnail, and again for next and prev mc onRelease() functions. You also have an enterFrame function that is constantly testing for the loading of those larger clips.

                If you add a loader test for the larger image, then you could put each loaded large image's name into an array. Then you can use the population of that array to control your animation. If the image needs to be loaded, wait until it loads, show the animation then show the large image. If the large image has already been loaded, then just show the animation and then the image.

                Did that help, or just make it worse?

                • 6. Re: Help with LoadMvoie
                  AudreyWalker1 Level 1
                  Hmm...still confusing. I understand the first portion, but for the image loading...I already have the image names in an array. image[]. I take care of that when I load in the XML information. I also do a testing for the load image on the onEnterFrame and then when a thumbnail is clicked, I check to see if the image is loaded. Should I be doing this somewhere else?
                  • 7. Re: Help with LoadMvoie
                    robdillon Most Valuable Participant
                    Yes, you have an array of the image names, but you don't know if the image has been loaded yet or not. The first time a thumbnail is selected, you load the larger image, wait for it to load, play the animation and then show the large image. That enterframe function is running all of the time, it is always testing the last selected image for its totalBytes value. Further it is always testing the bytesLoaded against the bytesTotal.

                    If you put a version of that enterframe function in the onRelease function, then you can run it as needed to load in the image the first time, after the image is loaded, add th image name to a new array. You can check this array in the onrelease function. If the image is already loaded, no need to load it again.

                    Finally, tell the picunder_mc to play. Test it as it plays an then change the alpha of the large image after picunder_mc has finished playing.

                    You can then delete the enterframe function after the large image's alpha is at 100.