We help IT Professionals succeed at work.

Button OnRelase function---- sending page back to top of browser of browser.

sam928 asked
Last Modified: 2013-11-11
hello All,,

I have a flash site with a button on the bottom of my page.  The button when clicked simply goes to another page within the flash movie.

--------The problem is, my site is 760x1000 sized, and since the button is at the bottom of the page, once I click on it, it loads the page no problem, but the page scroller is still at the bottom of the page,,

Question---------how do i make it so that when the button at the bottom of the page is clicked it brings the page content to the top of the browser, (just like an html page would do when you click on a button)

I am sure this is common problem for most people who have navigation buttons on the bottom of the page or even the middle somewhere.

===========what is the solution for this problem?  I'm thinking it is some simple AS that sends the scroll to a specific coordinate?

Please assist.. anyone........Thanks you.
Watch Question

you can't do this with actionscript alone but you can call a javaScript function in the html that will do it.
put this function in the BODY code of the html..

function resetScroller() {

in your flash movie anytime you want to reset the scrollbar put this on the frame you are going to..


so when the player lands on the frame containing this..the function is called.



hello Zeffer, how are you..

i guess i am doing something wrong here, not working ..

i have inserted your code in the index, ... i have attached the index.html below.

-----also i have attached the code on the frame that has the page we want to scroll to the top.

i load my pages in externally , so in this particular structure, i have have a container on the 6th frame.  on that frame, my code looks like this:



I am thinking that i didnt place the code on the index.html correctly?  Or does this not work with externally loaded  swf's?  I would imagine that it doesnt matter, because the container (loader) is on its own frame.  

any idea?  t.y.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>MorningStar Custom Homes</title>
<script type="text/javascript" src="swfobject/swfobject.js"></script>
<script type="text/javascript" src="swfaddress/swfaddress.js"></script>
<style media="all" type="text/css">
	body {text-align:center; margin:0px; padding:0px; background:#acd8ef;}
function resetScroller() {
<div id="flashcontent"></div>
<script type="text/javascript">
    var so = new SWFObject("website.swf", "site", "760", "970", "8", "#acd8ef"); 

Open in new window

you have the code right in the html and also in the swf.
I just tried it but only going from frame 1 to 2 of a main movie and it works..and as the scroller is controlled by the browser it should make no difference what the flash content is or how it is loaded..

the only thing I can suggest is to type the script as you have in line 19..it might be your browser is not reading the function with just <script>

<script type="text/javascript">
function resetScroller() {




it worked in internet explorer, BUT, not firefox. or opera.

hmmm ,, how do we fix that?

This one is on us!
(Get your first solution completely free - no credit card required)


thank you, it is exacty what i am looking for.
God bless

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.