---
title: "换页显示代码"
author: "Fis"
date: "2011-12-20T15:55:14Z"
tags: []
categories: ["编程语言"]
slug: "untitled"
draft: false
lastmod: "2011-12-20T15:55:47Z"
id: 1317796
url: "https://fis.iteye.com/blog/1317796"
---

```

var maxPage:int = Math.ceil(this.data.length / this._pageSize);

public function set currentPage(value:int):void {
	var oldPageIndex:int = this._currentPage;
	var page:int = oldPageIndex;
	if(value > oldPageIndex){
		page = Math.min(this._maxPage,value);
	}else {
		page = Math.max(1,value);
	}
	if(page != oldPageIndex){
		this._currentPage = page;
		this.redraw();
	}
}
```