# Pagination with AS3

**URL:** <https://forum.kirupa.com/t/pagination-with-as3/265321>\
**Category:** flash\
**Created:** [July 7, 2008, 6:40pm UTC](https://forum.kirupa.com/t/pagination-with-as3/265321 "2008-07-07T18:40:22Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![sharkb8](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@sharkb8](https://forum.kirupa.com/u/sharkb8)\
**Post date:** [July 7, 2008, 6:40pm UTC](https://forum.kirupa.com/t/pagination-with-as3/265321/1 "2008-07-07T18:40:22Z")

</div>

How do you pagintate with AS3? I’m using a htmlText to display XML info but I cant figure out how to paginate with that object. Any help is greatly appreciated!

---

<div class="post-metadata">

**Author:** ![mathew\_er](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mathew\_er](https://forum.kirupa.com/u/mathew_er)\
**Post date:** [July 7, 2008, 7:38pm UTC](https://forum.kirupa.com/t/pagination-with-as3/265321/2 "2008-07-07T19:38:22Z")

</div>

Do you mean scrolling? Or switching one content for another? You mention htmlText… does that imply that you use something like a Text control or a TextField? These classes just display whatever you give 'em… whatever you mean by paginating, you have to do it yourself.

If you mean scrolling the content (it doesn’t fit there vertically so you need to reveal the rest as necessary), you can use something like the ScrollBar (?) class and link it to the text field. There are multiple ways to do this depending wheter you are working in flash or flex. You can use components that are built into these tools or write your own one.

---

<div class="post-metadata">

**Author:** ![sharkb8](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@sharkb8](https://forum.kirupa.com/u/sharkb8)\
**Post date:** [July 7, 2008, 7:46pm UTC](https://forum.kirupa.com/t/pagination-with-as3/265321/3 "2008-07-07T19:46:00Z")

</div>

When there’s a ton of pages and to navigate through them, you use this on the pages:  
\<\<Previous page 1 2 3 4 Next page\>\>

---

<div class="post-metadata">

**Author:** ![mathew\_er](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mathew\_er](https://forum.kirupa.com/u/mathew_er)\
**Post date:** [July 7, 2008, 7:50pm UTC](https://forum.kirupa.com/t/pagination-with-as3/265321/4 "2008-07-07T19:50:41Z")

</div>

And what exactly is your problem?

---

<div class="post-metadata">

**Author:** ![sharkb8](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@sharkb8](https://forum.kirupa.com/u/sharkb8)\
**Post date:** [July 7, 2008, 8:08pm UTC](https://forum.kirupa.com/t/pagination-with-as3/265321/5 "2008-07-07T20:08:51Z")

</div>

How do you paginate with AS3?

---

<div class="post-metadata">

**Author:** ![2nd\_day](https://avatars.discourse-cdn.com/v4/letter/2/a4c791/32.png) [@2nd\_day](https://forum.kirupa.com/u/2nd_day)\
**Post date:** [July 7, 2008, 8:22pm UTC](https://forum.kirupa.com/t/pagination-with-as3/265321/6 "2008-07-07T20:22:47Z")

</div>

I think mathew.er wants you to be more specific… What do you already have got?  
How does your XML file look like? When you want to paginate your XML data I guess your XML file is quite similar to this:

```auto
<data>
   <page id=1>
      <text>Bladiebladiebla</text>
   </page>
   <page id=2>
      <text>Some more Bladiebladiebla</text>
   </page>
</data>

```

Is that correct?

In this case you have to learn some XML parsing with AS3. Then you could get the number of ‘Children’ of \<data\> (wich is 2). This is the number of pages. Then you can store the text of each page in a global variable so when you press the page 2 link it will display the text of page2 in you textfield (textfield.htmlText = XMLpage2 \<-- this depends on the names you choose for your variables and instances). This is one option to tackle the problem… I dont whether this was your problem or the actual AS3 code… Im used to AS1, so I dont really know much about AS3 (currently learning that) but i bet there are some nice folks here that can help you out.

---

<div class="post-metadata">

**Author:** ![sharkb8](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@sharkb8](https://forum.kirupa.com/u/sharkb8)\
**Post date:** [July 7, 2008, 8:28pm UTC](https://forum.kirupa.com/t/pagination-with-as3/265321/7 "2008-07-07T20:28:47Z")

</div>

That’s an interesting way to to tackle it. I found this:[http://www.ultrashock.com/tutorials/flash8/pagination.php](http://www.ultrashock.com/tutorials/flash8/pagination.php)  
but its as2. I guess I can use this tutorial and convert it to as3 sytanx.

---

<div class="post-metadata">

**Author:** ![2nd\_day](https://avatars.discourse-cdn.com/v4/letter/2/a4c791/32.png) [@2nd\_day](https://forum.kirupa.com/u/2nd_day)\
**Post date:** [July 7, 2008, 8:38pm UTC](https://forum.kirupa.com/t/pagination-with-as3/265321/8 "2008-07-07T20:38:00Z")

</div>

I dont exactly know what you want… Do you have 1 big text that you want to split in different pages (like in the tutorial) Or do you have different pages in a XML file (like I posted) that you want to display in Flash?

---

<div class="post-metadata">

**Author:** ![sharkb8](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@sharkb8](https://forum.kirupa.com/u/sharkb8)\
**Post date:** [July 7, 2008, 8:44pm UTC](https://forum.kirupa.com/t/pagination-with-as3/265321/9 "2008-07-07T20:44:14Z")

</div>

I dont have my coding right now. Basically its just a simple htmlText object that has links pulled from an XML feed. I just wanted to paginate all these links.

---

<div class="post-metadata">

**Author:** ![2nd\_day](https://avatars.discourse-cdn.com/v4/letter/2/a4c791/32.png) [@2nd\_day](https://forum.kirupa.com/u/2nd_day)\
**Post date:** [July 7, 2008, 8:48pm UTC](https://forum.kirupa.com/t/pagination-with-as3/265321/10 "2008-07-07T20:48:20Z")

</div>

So you problem is that your text (your links pulled from XML feed) is to big to fit your textfield so instead of using a scrollbar you want to paginate the text?

---

<div class="post-metadata">

**Author:** ![sharkb8](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@sharkb8](https://forum.kirupa.com/u/sharkb8)\
**Post date:** [July 7, 2008, 8:50pm UTC](https://forum.kirupa.com/t/pagination-with-as3/265321/11 "2008-07-07T20:50:17Z")

</div>

That’s correct sir. It’s about 1000 links and scroll bars aren’t cutting it. So my solution is pagination. Im sure there are tutorials for AS3 out there somewhere.

---

<div class="post-metadata">

**Author:** ![2nd\_day](https://avatars.discourse-cdn.com/v4/letter/2/a4c791/32.png) [@2nd\_day](https://forum.kirupa.com/u/2nd_day)\
**Post date:** [July 7, 2008, 9:02pm UTC](https://forum.kirupa.com/t/pagination-with-as3/265321/12 "2008-07-07T21:02:38Z")

</div>

There most be people here that can help you out… I think that tutorial you found could help you out although its AS2… It’s a good start.

---

<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 8, 2008, 1:35am UTC](https://forum.kirupa.com/t/pagination-with-as3/265321/13 "2008-07-08T01:35:48Z")

</div>

[http://www.n99creations.com/viewsnip.php?id=9](http://www.n99creations.com/viewsnip.php?id=9) should work with AS3 aas well I think

---

<div class="post-metadata">

**Author:** ![sharkb8](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@sharkb8](https://forum.kirupa.com/u/sharkb8)\
**Post date:** [July 8, 2008, 5:49pm UTC](https://forum.kirupa.com/t/pagination-with-as3/265321/14 "2008-07-08T17:49:28Z")

</div>

[QUOTE=nathan99;2355039][http://www.n99creations.com/viewsnip.php?id=9](http://www.n99creations.com/viewsnip.php?id=9) should work with AS3 aas well I think[/QUOTE]

Thank you nathan! You made my day man!
