switch(typeof(result)){
case "boolean":
//Convert to string and place in text box
myTextBox.text = result.toString();
break;
case "number":
//Convert to string and place in text box
myTextBox.text = result.toString();
break;
case "object":
//Create an array of values
var values:Array = result.serverInfo.initialData;
//Create an array of column names
var category:Array = result.serverInfo.columnNames;
var aArr:Array = new Array();
for (var i:Number=0; i < values.length; i++) {
aArr[i] = new Object();
for (var aIndex:* in category) {
aArr[i][category[aIndex]] = values[i][aIndex];
}
}
//Create a new Data Provider
var dp:DataProvider = new DataProvider(aArr);
//Assume we have a datagrid we wish to bind to
myDataGrid.removeAllColumns();
//Bind the Data Provider to the Data Grid
myDataGrid.dataProvider = dp;
//Get the row count
myDataGrid.rowCount = aDg.length;
myDataGrid.setSize(500,100);
break;
case "string":
myTextBox.text = result.toString();
default:
break;
}
hi (using flash cs5)
i’d like to ask which would be the code that would make possible to separate each column of a table in phpmyadmin, turn it into a dataprovider and then insert it into a column of a datagrid (column created by me, inside flash).
thanks for the attention!
Use the code for the “object” case. That will return the values as an array which can be used as a data provider for a data grid.