
Welcome Guest
|
#1
|
|||
|
|||
|
Hi to all of you,
I've been writing an external ActionScript class (named SQL), designed to handle XML-PhP-MySQL flux. The SQL object contains a property named "result" (an XML object that receives the XML from a sendAndLoad(); I've written a method named getXML() in order to load the XML from an external PhP file : Code:
public function getXML():Boolean {
var XMLtemp:XML = new XML(this.queryText); // an XML-formatted query that will be sent by php
var fileloadedOK:Boolean = true;
this.result.onLoad = function (success:Boolean) {
if (success) {
trace("XML successfully loaded");
if(this.resultat.status != 0) // Bad XML
fileloadedOK = false;
} else {
trace("Error while downloading the file");
fileloadedOK = false;
}
};
XMLtemp.sendAndLoad("http://localhost/myfile.php", this.result); // Sends the query to the server and gets an XML object back
return fileloadedOK;
}string, or an array, or simply returned as XML through methods such as SQL.asString(), .asXML() or .asArray(). The problem is : the XML.load() method is asynchronous, so that means the program directly goes to the instruction "return fileloadedOK" before the XML is actually correctly loaded. The methods asString, asXML and asArray must use SQL.result as a base to return a result, so errors occur, as the XML is still not loaded. I tried a while(this.result.loaded != true) but all I get is an infinite loop :-/ I've been told to use a listener, but I searched the web and didn't find anything that rang some bells, anyone has an idea how to do ? Thanx in advance
|
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| XML PRELOAD Problem | grafxidg | Newbies |
3 | 04-08-2010 01:06 AM |
| Question|my first post - problem with link in SWF file | james341 | Flash CS4 |
0 | 09-28-2009 08:49 AM |
| textfield focus problem in external swf | mrpoate | Newbies |
1 | 07-10-2007 11:34 AM |
| Link problem | 0morgan0 | Newbies |
3 | 12-01-2005 07:48 AM |
| weird problem; what's the initialization sequence in AS2? | Sewdn | Actionscript 2.0 |
1 | 08-20-2004 03:36 PM |

Other Programming



