5 Replies Latest reply on Feb 8, 2008 9:02 PM by clbeech


      How do I get an actionscript for "jumping to top of page" command? After someone is done reading through a page there is a next button at the bottom. I want to be able to jump to the top of the next page instead of having to scroll up. Is this possible in flash? I would think it is. Thanks
        • 1. Re: JUMP TO TOP OF PAGE
          clbeech Level 3
          would this be the html page?? or are you 'scrolling' a textfield instance?

          if the former, you may need to use some JavaScript, if the latter, you could reset the scroll property to 0.
          • 2. Re: JUMP TO TOP OF PAGE
            mlln-prod Level 1
            It is the page and not a text field. The site link is www.mlln.net/crown if you want to see it. What JavaSript would I add and would this be an action on the button or where would I put it? Thanks
            • 3. Re: JUMP TO TOP OF PAGE
              To do it in HTML, include this code at the very top of the page, right after the <body> tag.

              <a name="top">

              Then include this code to create the link to the top

              <a href="#top">Text for link goes here</a>
              • 4. Re: JUMP TO TOP OF PAGE
                Damon Edwards Level 3
                A much more reliable way would be to, as clbeech said, use ExternalInterface to call a Javascript function to scroll to the top of the page. Yes, anchor tags are an option, but not a reliable option, as differences in browsers can cause unforeseeable results.
                • 5. Re: JUMP TO TOP OF PAGE
                  clbeech Level 3
                  FreddyU - that probably wont work in this case, since the associated button is within the Flash file and there may be cross browser compatibility issues, as dzedward has pointed out.

                  mlln-prod: you will need to set up a javascript function in the html document, the JS code below should be located within the 'head' tag, then you will use the AS code below within the file, and call the JS method from your button's onPress or onRelease handler.