Solved

flash button links to HTML anchor

Posted on 2007-03-29
6
563 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
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).

730 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