Solved

flash button links to HTML anchor

Posted on 2007-03-29
6
556 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now