I am new to action scripting, and want to know that how to paginate the data coming from mysql data base and how to dynamically send one of them back to php page,
i use the following code for pagination but don’t know how to dynamically send the data back to page by click on the button on the text field.
//the current page we’re on
var page:Number = 1;
//the limit of values we need per page
var limit:Number = 20;
//the current row that we’re working on
var row:Number = 0;
//The total pages that we have
var totalPages:Number = Math.ceil(values.length/limit);
//the text at the bottom of the page
var pageTxt:String = 'Page ‘+page+’ out of '+totalPages;
//the function that will add all of the mc’s to stage
function createValues():Void{
//this will always limit the amount to the limit variable
//but, “i” will act as a marker for which part of the values
//array that we’re going to use
for(i=(page-1)limit;i<pagelimit;i++){
//checks if there actually is a value where “i” is
//otherwise we’ll get some undefined movieclips
if(i < values.length){
//attaches the movieclip to the stage
attachMovie(‘mcValueHolder’, ‘value2’+row, getNextHighestDepth());
//sets the coordinates based on the row
if(row>9){
_root['value2'+row]._x = 300;
if(i%10==0){
var j=35;
_root['value2'+row]._y = j;
}else{
j = j +20;
_root['value2'+row]._y = j;
}
}else
{
_root['value2'+row]._x = 15;
_root['value2'+row]._y = 35+_root['value2'+row]._height*row;
}
// _root[‘value’+row]._y = 5+_root[‘value’+row]._heightrow;
//sets this guys value to the correct part of the array
_root[‘value2’+row].thisValue = values;
//move onto the next row
row ++;
}
}
//then we reset the rows so we can use the variable again
row=0;
}
//we have to remove movieclips from the stage if we’re going to paginate
function removeValues():Void{
//its a simple function, hopefully you can understand it
for(i=0;i<limit;i++){
_root[‘value2’+i].removeMovieClip();
}
}
//adding functions to the buttons when they’re clicked
mcPrev.onRelease = function(){
//if the page isn’t too low
if(page > 1){
//then go to the previous page
removeValues();
page --;
createValues();
//updating the text
pageTxt = 'Page ‘+page+’ out of '+totalPages;
}
}
mcNext.onRelease= function(){
//if the page isn’t too high
if(page < totalPages){
//then go to the next page
removeValues();
page ++;
createValues();
//updating the text
pageTxt = 'Page ‘+page+’ out of '+totalPages;
}
}
//we’re going to have to show the values first thing
createValues();