Solved

flash button links to HTML anchor

Posted on 2007-03-29
6
559 Views
Last Modified: 2008-02-01
I have a button in flash that i want to link to an HTML anchor. My swf is 1125 px high and when you click on this button i want it to move the page to the top of the window without reloading the page.

i have tried:

on (press) {
      getURL("javascript:window.location.href=\"#top\"");
}

which kinda works in safari but it never stops loading the page and it freezes up, and tyhis doesnt work in firefox

i have also tried:

on (press) {
      getURL("#top"");
}

which reloads the page

Thanks

Peter
0
Comment
Question by:CosmicKoder
  • 3
  • 3
6 Comments
 
LVL 4

Expert Comment

by:secondv
ID: 18820700
Try this.

In your documents <head> section:

<script language="JavaScript">
function newWin(url, name, options)
{
      return window.open(url, name, options);
}
</script>


then in flash:

on (press) {
      getURL("javascript:openNewWindow('page.html#top','_parent')");
}
0
 
LVL 4

Expert Comment

by:secondv
ID: 18820704
My apologies, I hadn't fully edited the code before posting (need an edit..)

use the following:


In your documents <head> section:

<script language="JavaScript">
function newWin(url, name, options)
{
      return window.open(url, name, options);
}
</script>


then in flash:

on (press) {
      getURL("javascript:newWin('page.html#top','_parent')");
}
0
 

Author Comment

by:CosmicKoder
ID: 18820754
tried it and it doesnt work in safari and in firefox it loads this in the address bar "javascript:href="#top""

you can see an example of the page at:

http://www.fieldstonecommunity.com/review/

click on team and than on builders. Scroll to the botton, the button next to woodridge homes that says photos has the actionscript code that you gave me.

Thanks

Peter
0
ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

 

Author Comment

by:CosmicKoder
ID: 18820768
i had made a mistake in my last post. I pasted the actionscript you gave me on the wrong button. I redid and retested. It works sort of, but it reloads the whole page so now i am back at the home page.

you can test here

you can see an example of the page at:

http://www.fieldstonecommunity.com/review/

click on team and than on builders. Scroll to the botton, the button next to woodridge homes that says photos has the actionscript code that you gave me.

Thanks
0
 
LVL 4

Accepted Solution

by:
secondv earned 500 total points
ID: 18822509
Try changing it to:

on (press)
{
      getURL('javascript:self.scrollTo(0, 0)');
}

which works.  http://scriptgod.com/anchortest.html  (scroll to the very bottom click either "Anchor" or "Test")

0
 

Author Comment

by:CosmicKoder
ID: 18824867
thast is so awesome! thank you so much!!!
0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question