Hi!
I was wondering whats the best approach to do a query to a mysql database, and getting all the results from a table into Flash. I was thinking something like this:
var a:Number = 1;
var total:Number = 3;
var loads = new LoadVars();
var sends = new LoadVars();
sends.sendAndLoad('go.php?rand='+getTimer()+random(9999), loads, 'POST');
loads.onLoad = function(Success:Boolean){
if(Success){
//attaches some Movieclip
something = this.variable;
if(a<total){
a++;
sends.sendAndLoad('go.php?rand='+getTimer()+random(9999), loads, 'POST');
}
}
}
The go.php does a query to the database. So this does a sort of a loop, and, each time it gets the variables from the go.php, it sends again the request to another query. But I’m worried about the efficiency of this approach, because it does a query for every movie I want to attach.
So, is it better to do a single query in php and get all the results to an array and then send it to Flash? But how can I do that? I think that flash doesnt “reads” array sent from php, or does it?
Anyway, any help you could provide, I would be grateful. Thanks!