Log in

View Full Version : HTML anchors (top) in loaded text



Darqueness
04-28-2008, 09:52 PM
Okay - so maybe I am going about this all the wrong way - :confused:

But I have text in a scrolling text box I want to be able to anchor "top of page" links to from various points in the page. (same document navigation)
It's a no brainer in HTML, but Flash isn't liking the link/anchor hard coding I did to my .txt document

The document shows up fine, all the html formatting is there - but the anchor links aren't working properly -

I used

myData = new LoadVars();
myData.onLoad = function() {
myText_txt.html = true;
myText_txt.htmlText = this.myVariable;
};
myData.load("content.txt");

to call the file - which is working fine.

and in the .txt file I used

<a name="top">top</a> for the anchor
<a href="#top">Back to top</a> for the link

Suggestions?

If there is a better (easier, less blonde) :eek: way to go about this, I am all ears -

Medyman
04-28-2008, 10:20 PM
I see a few potential culprits here:

1) Are you setting the <a name=".."> tab within flash? If so, that's not going to work. Firstly, I'm not sure if Flash is able to read the <a name=".."> tag. It can read anchors but I'm not sure if all the properties are available to it. Even if it can though, your linking to the same point from where you're calling the link, so it won't make a difference. You're better off declaring that directly in your HTML.

2) Is the link showing up in Flash? If not, it's probably because you're not escaping the quotes. Change this:

<a href="#top">Back to top</a>
to

<a href=\"#top\">Back to top</a>


Tip: If you're going to be using Flash for navigation, make sure there is an alternative for people that don't have Flash installed.

Darqueness
04-28-2008, 11:36 PM
Well - it's a text document called into Flash - so I don't want to escape them quotes (otherwise the html won't render)

This is the site in question - J Cargill Image (http://www.jcargillimage.com/janet.html)the page I am talking about is the "Packages for Individuals" link - the text is scrolling - formats seem to have taken (didn't quite get it finished) the links are active links, they just don't work.

I'm thinking the format I am using is missing something, but I can't for the life of me figure out what.

Medyman
04-29-2008, 12:00 AM
Oh I see...

You can't simply bring an HTML page into flash. It doesn't quite work like that. Internal page anchors are HTML syntax. They won't work from within flash. If you had anchors set in HTML, and were calling it from Flash, that would work.

Assuming that that's just one giant text area that you're linking to, you won't be able to get this type of thing to work. If each of the links and sections were seperate textfields, you could use the scroll property of the textfield, but I doubt that's how you have it set up because that would have required a lot of custom AS.

May I ask why you chose to do this site in Flash? You can duplicate the functionality (and add more) using plain old HTML. Flash only adds limitations to this design.

Darqueness
04-29-2008, 12:14 AM
It's one of those 'the customer isn't always right but thinks they are' situations.

Thanks for your help though ;o)