# "back to top"

**URL:** <https://forum.kirupa.com/t/back-to-top/265457>\
**Category:** flash\
**Created:** [July 9, 2008, 5:20am UTC](https://forum.kirupa.com/t/back-to-top/265457 "2008-07-09T05:20:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lillies123](https://avatars.discourse-cdn.com/v4/letter/l/a87d85/32.png) [@lillies123](https://forum.kirupa.com/u/lillies123)\
**Post date:** [July 9, 2008, 5:20am UTC](https://forum.kirupa.com/t/back-to-top/265457/1 "2008-07-09T05:20:37Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![randomagain](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@randomagain](https://forum.kirupa.com/u/randomagain)\
**Post date:** [July 9, 2008, 8:16am UTC](https://forum.kirupa.com/t/back-to-top/265457/2 "2008-07-09T08:16:46Z")

</div>

no one here knows check else where 😛

---

<div class="post-metadata">

**Author:** ![nathan99](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@nathan99](https://forum.kirupa.com/u/nathan99)\
**Post date:** [July 9, 2008, 8:49am UTC](https://forum.kirupa.com/t/back-to-top/265457/3 "2008-07-09T08:49:08Z")

</div>

are you saying you want a back to top in a textfield or what?

---

<div class="post-metadata">

**Author:** ![lillies123](https://avatars.discourse-cdn.com/v4/letter/l/a87d85/32.png) [@lillies123](https://forum.kirupa.com/u/lillies123)\
**Post date:** [July 9, 2008, 11:33am UTC](https://forum.kirupa.com/t/back-to-top/265457/4 "2008-07-09T11:33:46Z")

</div>

> [@nathan99;2355617](#):
>
> are you saying you want a back to top in a textfield or what?

Yeah, is that possible? Thanks.

---

<div class="post-metadata">

**Author:** ![glosrfc](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/glosrfc/32/8334_2.png) [@glosrfc](https://forum.kirupa.com/u/glosrfc)\
**Post date:** [July 9, 2008, 2:01pm UTC](https://forum.kirupa.com/t/back-to-top/265457/5 "2008-07-09T14:01:37Z")

</div>

It’s possible, using the asfunction:

```auto
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](http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_15639&sliceId=2) or by checking the help files ActionScript language elements \> Global Functions \> asfunction protocol

---

<div class="post-metadata">

**Author:** ![lillies123](https://avatars.discourse-cdn.com/v4/letter/l/a87d85/32.png) [@lillies123](https://forum.kirupa.com/u/lillies123)\
**Post date:** [July 9, 2008, 2:50pm UTC](https://forum.kirupa.com/t/back-to-top/265457/6 "2008-07-09T14:50:08Z")

</div>

Oh! Awesome! Thanks so much, Glosrfc! I really appreciate your help.
