Solved

flash button links to HTML anchor

Posted on 2007-03-29
6
558 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

929 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

14 Experts available now in Live!

Get 1:1 Help Now