the problem you may run into if you call in a loop is overwriting the object
property.
i would implement a queue:
///////////////
private var statementQueue:Vector.<SQLStatement> = new Vector.<SQLStatement>();
public function getDayOfDrill() : void {
var sql:SQLStatement = new SQLStatement();
sql.sqlConnection = _sqlConnection;
sql.text = "SELECT dayOfDrill FROM time";
sql.addEventListener(SQLEvent.RESULT, getDayOfDrillResultHandler, false, 0,
true);
statementQueue.push(sql);
sql.execute();
}
private function getDayOfDrillResultHandler(e:SQLEvent) : void {
var evt:FDataEvent = new FDataEvent(FDataEvent.GET_DAY_OF_DRILL);
evt.param = e.target.data[0];
dispatchEvent(evt);
statementQueue.splice(statementQueue.indexOf(e.target,1);
}
//////////////////
On Apr 20, 2011, at 3:43 PM, Henrik Andersson wrote:
> Mattheis, Erik (MIN-WSW) skriver:
>> 1. The SQLConnection is asynchronous. Is there a possibility the function
>> variable "sql" would get garbage collected before the event handler fires?
>
> It is a local variable. Yes, it is up for garbage collection the instant the
> function returns. So if the event happens after that (as you said it will)
> then the garbage collection may happen before that.
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders