Oracle -> php -> flash delay

I’m building a database application using flash, php, and oracle. my problem is that the flash is stored on one server but the database is on another server. Needless to say, there is a lag time when they try to communicate. I’m ok with this lag time.

My problem is that if i’m filling my variables with values from the database, those values are arriving after flash makes a decision. Like i’ll have an if statement that compares the value of the variable to something and it ends up comparing the old value of the variable because it takes a while for the new value to come.

Is there some kind of actionscript that will take care of this problem. Is there something like “on load variable” or something like that?

Thanks.

Danny