Pagination with AS3

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!

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.

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>>

And what exactly is your problem?

How do you paginate with AS3?

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:

<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.

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

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?

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.

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?

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.

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.

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

[QUOTE=nathan99;2355039]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!