Hi,
I have a file full of text; if this were html, I’d just make an iframe and in the frame, I’d have the text page with “back to top” links throughout. But since this is flash, I’m loading an external text file, and I’d like some “back to the top” links within it. I know how to do a “back to the top” in html, but it doesn’t seem to work in a loaded text file in flash. Or is there a better way to present a lot of information in flash? What would you suggest?
I’ve been agonizing over this for days and I’d appreciate any help at all.Thanks!
no one here knows check else where
are you saying you want a back to top in a textfield or what?
Yeah, is that possible? Thanks.
It’s possible, using the asfunction:
stop();
//create function to scroll to the anchor point
function scrollAnchor(anchor) {
trace(anchor);
textArea.scroll = anchor;
}
// load external textfile into textfield
var lv = new LoadVars();
lv.onData = function(inString){
textArea.htmlText = inString;
}
lv.load("anchor.txt");
Your textfile should contain anchor tags that contain an asfunction that references the scrollAnchor function as well as the anchor argument you wish to pass .e.g. [COLOR=“DarkSlateBlue”]<a href=“asfunction:scrollAnchor,1”>Back to top</a>[/COLOR]
Your anchor argument can be any valid horizontal line in your textfield so there’s no reason why you can’t create links to jump forwards as well as backwards.
A sample is attached and further information about asfunction can be obtained here or by checking the help files ActionScript language elements > Global Functions > asfunction protocol
Oh! Awesome! Thanks so much, Glosrfc! I really appreciate your help.