8 Replies Latest reply on Apr 25, 2010 6:43 PM by Ned Murphy

    Scrolling a Pane to the Top of a Flash Movie

    richmaxw Level 1

      Hi,

       

      I'm working on a site for a customer: <http://home.comcast.net/~richmaxw/tests/kris/>. The problem is that when you click on "About," then "Gear," then scroll down, and then click on another link (like "Photos") the pane does not go back to the top. I know that this is very trivial, but the customer is insisting that I fix it. I can privately send a link to the .fla source file to anyone who replies here. Thank you in advance for any help.

       

      Sincerely,

       

      Richard

        • 1. Re: Scrolling a Pane to the Top of a Flash Movie
          Ned Murphy Adobe Community Professional & MVP

          It appears you need to reset the scroller and the content location anytime one of the subsections is selected.  What code do you currently have relative to that panel and the scroller?

          1 person found this helpful
          • 2. Re: Scrolling a Pane to the Top of a Flash Movie
            richmaxw Level 1

            Hi Ned,

             

            Here is the source file for the movie: <http://home.comcast.net/~richmaxw/movie.fla>. The left-hand pane in question is stored in frame 2 of the "action content copy" movie clip. The code for the right-hand pane is stored in the "action sc copy 3" movie clip. I've also noticed some ActionScript in the "action sc copy" movie clip inside the "dragMC" scroll button.

             

            Thanks,

             

            Richard

            • 3. Re: Scrolling a Pane to the Top of a Flash Movie
              Ned Murphy Adobe Community Professional & MVP

              It will be better if you show the code from the file relative to the scroll controls.  I won't be downloading a 50 MB file and other people that help here won't download a file under any circumstances short of being hired.

              • 4. Re: Scrolling a Pane to the Top of a Flash Movie
                richmaxw Level 1

                Here is the code inside the scroll button:

                 

                onClipEvent (load)
                {
                 oldY = 1;
                 Y = 1;
                 vY = 0;
                 newY = 0;
                 mouseWheelHitTest = true;
                 contentHeight = _parent.scrolledMC._height;
                 scrollSpeed = _parent.speed_content;
                 scrollStep = _parent.step_content;
                 viewHeight = _parent.line._height;
                 buttonSize = _parent.dragMC._height;
                 buttonY = buttonMC._y;
                 scrollHeight = _parent.scrolledMC._height + 875;
                 scrollContent = _parent.scrolledMC._y;
                 scrollContent1 = _parent.scrolledMC;
                 newY = _parent.scrolledMC._height;
                 var mouseListener:Object = new Object();
                 mouseListener.onMouseWheel = function(delta)
                 {
                  if (!mouseWheelHitTest || scrollContent1.hitTest(_root._xmouse, _root._ymouse, false) || hitTest(_root._xmouse, _root._ymouse, false))
                  {
                   if (buttonMC._y>=0 && buttonMC._y<=scrollHeight-buttonSize+1)
                   {
                    buttonMC._y -= (delta)*_parent.mouse_speed;
                   }
                  }
                 };
                 Mouse.addListener(mouseListener);
                 hiScroll = _parent.line._height-_parent.dragMC._height;
                 step = ((scrollHeight-buttonSize)-(hiScroll))/(hiScroll);
                 y = _parent.scrolledMC._y;
                }
                onClipEvent (enterFrame)
                {
                 if (_parent.drag_but)
                 {
                  if (buttonMC._y>=0)
                  {
                   buttonMC._y -= scrollStep;
                  }
                 }
                 
                 if (_parent.down_but)
                 {
                  if (buttonMC._y<=scrollHeight+buttonSize)
                  {
                   buttonMC._y += scrollStep;
                  }
                 }
                 
                 if (buttonMC._y<=0)
                 {
                  buttonMC._y = 0;
                 }
                 
                 if (buttonMC._y>=viewHeight-buttonSize)
                 {
                  buttonMC._y = viewHeight-buttonSize;
                 }
                 
                 level = buttonMC._y-buttonY;
                 lev = int(y-(level*step));
                 newY = oldY+(lev-oldY)/scrollSpeed;
                 _parent.scrolledMC._y = newY;
                 oldY = newY;
                }
                


                And here is code on the top of the frame for the pane:

                 

                mouse_speed = 2;
                speed_content = 6;
                step_content = 10;
                step = 5;
                scrolledMC.setMask(mask);
                stop();
                
                • 5. Re: Scrolling a Pane to the Top of a Flash Movie
                  Ned Murphy Adobe Community Professional & MVP

                  Can you also show the code for one of the links that changes the section?  That is likely where you will be adding some code to reset the positions of things.

                   

                  I cannot be sure, but my best guess would to offer that the code that changes the sections will need to set the buttonMC._y value and the scrolledMC._y value both to zero (or whatever values they normally start at).

                  • 6. Re: Scrolling a Pane to the Top of a Flash Movie
                    richmaxw Level 1

                    Here is the code for the "Gear" link:

                     

                    on (rollOver)
                    {
                     gotoAndPlay("s1");
                    }
                    
                    on (releaseOutside, rollOut)
                    {
                     gotoAndPlay("s2");
                    }
                    
                    on (press)
                    {
                     var cBiography:Color = new Color(this._parent.bio_mc);
                     var cGear:Color = new Color(this._parent.gear_mc);
                     var cPhotos:Color = new Color(this._parent.photos_mc);
                     
                     cBiography.setRGB(0x999999);
                     cGear.setRGB(0xFFFFFF);
                     cPhotos.setRGB(0x999999);
                     
                     this._parent.bio_txt.textColor = 0x999999;
                     this._parent.gear_txt.textColor = 0xFFFFFF;
                     this._parent.photos_txt.textColor = 0x999999;
                     
                     _root.content.page001.actionSc_mc.scrolledMC.gotoAndStop(2);
                    }
                    

                     

                    I wrote the code inside on (press). Everything else I've shown you came with the template. I added some extra frames inside scrolledMC for the gear list and photos. Hence the gotoAndStop statement. The rest of my code deals with changing the color of the title of the visible section to white.

                    • 7. Re: Scrolling a Pane to the Top of a Flash Movie
                      richmaxw Level 1

                      It looks like you were right. I just added this code to the bottom of the above code, and it seems to work:

                       

                      _root.content.page001.actionSc_mc.scrolledMC._y = 0;
                      _root.content.page001.actionSc_mc.dragMC.buttonMC._y = 0;
                      

                       

                      Thank you,

                       

                      Richard

                      • 8. Re: Scrolling a Pane to the Top of a Flash Movie
                        Ned Murphy Adobe Community Professional & MVP

                        That's great... mostly because it's hopefully resolved, and partly because that's about all I could have suggested you try.... and you saved me from trying to figure out the path to target those puppies.