After reading some posts on this, I learned a lot. Now I'm sharing it with you
Flash is now just a display function. During the process, I looked at some other people's things and felt that pagination seems to have a very simple implementation method. Basically, they are transmitted in XML. Displaying with list components and datagrid is OK. Here I use dynamic text because I think it's too troublesome to use the components. So I used a stupid method, and there is no way, and I can't find a better one~~ The list[..] in the following code is the name of dynamic text, showing 15 pieces at a time.
//The display program is as follows:
//Frame name "list"
stop();
varlogList=newXML();
varlogroot;
varpage:Number;//Current page
varTpage:Number;//Save the total page
varTnum:Number;//Total log count
varlogname:String;//Log Classification Name
vartemp;
vari:Number;
// Here I use an array to store the corresponding id number. If you use the component, you won't have to worry about it.
variables=newArray(15);
//Two buttons are used to turn pages
bn_u.enabled=false;
bn_d.enabled=false;
if(page==nullorpage<1){
page=1;
}
//------------------------------
//Clear function;
functionmyclear(){
for(i=1;i<16;i++){
ids[i-1]=0;
list["lbn"+i]._visible=false;
list["ltitle"+i].text="";
list["lauthor"+i]="";
list["ltime"+i]="";
}
}
//--------------------------------------
//--------------------------------------
myclear();
pageInfo.text="Reading data...";
logList.ignoreWhite=true;
logList.load("Tree_list.asp?log_cat="+cat_id+"&page="+page);
//------------------------------------------------
//get data function
functionlogFunc(e){
if(e){
logroot=logList.firstChild;
logname=logroot.attributes.logname;
Tpage=logroot.attributes.Tpage;
Tnum=logroot.attributes.Tnum;
temp=logroot.firstChild;
list.ltitle1.text=Ftitle(temp.firstChild.nodeValue,22);
list.lauthor1=temp.attributes.author;
list.ltime1=temp.attributes.Addtime;
ids[0]=temp.attributes.id;
i=1;
list.lbn1._visible=true;
//Read nodes in loop
while(temp.nextSibling!=null){
temp=temp.nextSibling;
i++;
//If it is displayed in another way, you just need to change it.
ids[i-1]=temp.attributes.id;