3 Replies Latest reply on Aug 12, 2010 9:24 AM by Ned Murphy

    Question about scrolling and Movie Clips Loaded from the Library

    HollyLafflin

      I hope I am posting this in the right forum.

       

      Ok, I'm using actionscript 2.0, and I am trying to make a scrolling image gallery. I have a movie clip with three layers. the first contains a movie clip used as a scroll bar. The second is a mask used to hide the overflow content, and the third contains movie clip thumbnails. when I click one of the thumbnails, it loads a symbol containing a larger version of the picture over top of the thumbnails on the same layer. My problem is, the large image is added at the very top of the movie clip, even when it is scrolled out of sight. I want it to appear in sight, so the user doesn't have to scroll all the way back up to the top to see it. This is annoying and confusing. Is there a way to do this?

       

      Here is the code I used to create the scroll effect (there is actually a whole lot more to the code but it is very long, so I am not adding it now. I will if it is needed though) 

      (Oh, and there is no text involved in this. I just got this code off a tutorial and I haven't changed the variable names yet)

       

          var scrollUpper:Number = 58;
          var scrollLower:Number = 309;

       

          var textLower:Number = 60;
          var textUpper:Number = -179;

       

          var scrollRange:Number = scrollLower - scrollUpper;
          var textRange:Number = textLower - textUpper;
          var startY:Number = imagesHolder_mc.thumbs_mc._y;

       

            //
          function scroll(){
             var moved:Number = imagesHolder_mc.scroller_mc._y - scrollUpper;
             var pctMoved:Number = moved/scrollRange;
             var textMove:Number = pctMoved*textRange;
             imagesHolder_mc.thumbs_mc._y = textLower - textMove;
             
          }

       

          imagesHolder_mc.scroller_mc.onPress = function(){
             this.startDrag(false,this._x,scrollUpper,this._x,scrollLower);
             this.onMouseMove = scroll;
          }

       

          imagesHolder_mc.scroller_mc.onRelease = scroller_mc.onReleaseOutside = function(){
             this.stopDrag();
             this.onMouseMove = null}

        • 1. Re: Question about scrolling and Movie Clips Loaded from the Library
          Ned Murphy Adobe Community Professional & MVP

          From what you explained, it seems as though you need to tell whatever is being scrolled to adjust its position such that the top is in the viewing area after a new symbol is added.  I don't see where it would involve your scroll controls, just the position of what's being scrolled.

           

          I'm a little curious.  You seem to be saying that as new images are selected, they are added to whatever else has already been selected, thus the reason for scrolling to see things.  Why don't you just display the selected image and remove whatever precedes it so that there's no need to scroll?

          • 2. Re: Question about scrolling and Movie Clips Loaded from the Library
            HollyLafflin Level 1

            Thanks for your reply. I'll try to explain it better. I have a long, vertically scrolling movie clip. This movie clip contains lots of thumbnails. When I click a thumbnail, the full sized image is loaded from the library and displayed within the same movie clip. when I click the full size movie clip, it disappears again, and I can click another thumbnail to display another full size image. So I'm not just adding more and more stuff to the gallery if that's what you were thinking. I'm just clicking thumbnails to display the full size image so I can look at it, closing it, and moving on.

             

            But the full sized image is fixed at the very top of the scrolling movie clip, so if I click a thumbnail at the very bottom, I have to scroll all the way back up to the top to see the full size image. I just want the full size image to appear on screen no matter how far down I have scrolled to click a thumbnail.

             

            I made my basic gallery useing this tutorial:

            http://flashexplained.com/actionscript/making-the-ultimate-dynamic-image-gallery-in-flash- 8/

            if you want to take a look at that, to get an idea of what I'm talking about.

             

            Now I'm just trying to add some scrolling functionality, which wasn't included, but I don't really understand actionscript well enough to do this easily on my own.

             

            Sorry for the long reply. I hope this is clearer.

            • 3. Re: Question about scrolling and Movie Clips Loaded from the Library
              Ned Murphy Adobe Community Professional & MVP

              Add the large image to a separate movieclip that is fixed to a position on the stage instead of the thumbnail one.