Paginator AS3

I’ve got a couple projects currently in production that require the pagination of data which has lead to PaginatorAS3. It’s a small controller/model for paginating data contained in a Array. Pagination seems to pop-up in a lot of ActionScript projects in a variety of forms, so I decided to formalize it into a flexible object. PaginatorAS3 contains no views, but takes care of all the data management in a clean simple implementation.

To create a new paginator you do the following:

paginator = new Paginator(myArray);

Then to retrieve the data set for a page you can do the following:

paginator.getCurrentItems();

It supports 3 page scrolling types, NONE (see all pages), SLIDING (current page in the middle), and JUMPING (jumps by groups of pages), additionally you can control the number of pages to appear at one time. (NONE ignores this)

Below is a simple demo using the sliding scroll style.

Download the source and demo here. (Demo code included)

Tagged:

Flash, ActionScript-3, paginator,pagination, development, code

Comments

Comment functionality has been disabled. Contact me on Twitter.

Whitefinger said:

Wow this is great i have been searching all over the net for some code that will help me with pagination in as3 as there doesn’t seem to be much out there. just in-case im on the wrong tracks as im a newbie can i use this code for flash builder? and if so will i be able to link my php scripts to it to link the data from mysql?

i have searched all over the net for about a week and every one else just wants pagination with datagrids and scrollbars!

Tyler Egeto said:

@Whitefinger Absolutely, you can use this any where you are building Flash applications. All this requires for pagination is an Array. I hope you find it helpful!

Recent & Popular Articles

Browse All >