4 Replies Latest reply: Aug 21, 2012 4:17 AM by NishanthFlex RSS

    ScrollPane behavior

    jeffbruce Community Member
      When I try the sample provided in the help doc (Flash 8, Windows XP):

      Live Docs Sample

      The behavior of the scrollpane isn't working correctly for me.

      It sort of works, in that if you don't play close attention and arrow up and down, the image scrolls up and down, but pay close attention to the scrolling. When the sample starts, the scrolling "view" should be the top left of the image. If you click the "down" arrow once, it should move the image "up" in the scroll pane. On my system, nothing happens on the first click. On the second click, it starts to behave "correctly" in that it will scroll the image up slightly.

      If I click the "down" arrow several times, then the the "up" arrow an equal number of times to try to get back to the top of the image, it won't scroll all the way. If you drag the scroll thumb, you can make it go all the way to the top.

      I get similar behavior with the horizonal scroll as well.

      Anyone else see this?
        • 1. Re: ScrollPane behavior
          jeffbruce Community Member
          Would somebody with the Flash authoring environment please try this? It should take you less than 2 minutes to try...
          • 2. Re: ScrollPane behavior
            beesOnTarmac Community Member
            Hello,

            You've probably found a fix for this by now but I thought I'd pass on my workaround anyway. I emailed macromedia (well adobe now) and they said this is a known bug that they have no patch for. Anyway after a lot of swearing, forum searches, breaking things and sticking pins in scrollpane voodoo dolls I came up with this:

            function scrollBugFix(targetPane)
            {
            var spListener:Object = new Object();
            spListener.scroll = function(eventObject:Object):Void
            {
            var maxVPos:Number = eventObject.target.maxVPosition;
            if (targetPane.vPosition == 0)
            {
            trace ("scroll - fixing top");
            targetPane.vPosition = 0;
            }
            else if(targetPane.vPosition == maxVPos)
            {
            trace ("scroll - fixing bottom");
            targetPane.vPosition = maxVPos;
            }
            };
            // Add listener.
            targetPane.addEventListener("scroll", spListener);
            }

            I've not done much coding and I don't really know why this works - seems a bit bizarre finding out if something is zero and if it is setting it to zero, but hey it worked for me so it might work for you.

            cheers
            chris
            • 3. Re: ScrollPane behavior
              Jim Layher Community Member
              I'm stumbling coming out of the blocks on my first project, hitting this exact same issue.

              I can't this workaround to work for me but since I'm so green, I'm probably not placing it the right spot. Where hor how exactly should this code be incorporated?

              Thanks for any help you can provide!
              • 4. Re: ScrollPane behavior
                NishanthFlex

                Solution For This

                whenever you init the scroll pane, i mean in the first frame of the movie clip where you added the scroll pane component add a event listner for the scroll. the code should be like this

                 

                var scrollPaneListener = new Object();
                    scrollPaneListener.scroll = function(eventObject:Object):Void {
                       results_sp.invalidate();
                    };
                    results_sp.addEventListener("scroll", scrollPaneListener);

                This solves the problem. :-)