flash actionscript:
Hi I'm trying to send and receive data to/from flash and php using sendAndLoad, but I can't receive any data from php. Other info: I'm running this locally and the path is correct. so yea I can't see anything inside the text field, I can't even trace it.. it says UNDEFINED. Thank you.. apprceciate it. Ivan //Code for PHP:// <?php require( "../weeklybread.php" ); $query = mysql_query( "SELECT * FROM $table" ); while($myrow = mysql_fetch_array( $query )) { $message = ($myrow['message']); $message = trim($message); $id = ($myrow['id']); $subject = ($myrow['subject']); } echo ("&subject=". $subject); ?> //Code for AS:// myVars = new LoadVars(); myVars_received = new LoadVars(); myVars.onLoad = function(success) { if (success) { _root.title_txt.text = myVars_received.subject; } }; myVars.sendAndLoad("http://localhost/gii_lite/display2.php", myVars_received, "POST");
The data is received by myVars_received, so you should place the code for handling it in myVars_received.onLoad. Then try testing it outside the Flash IDE, the Flash Help indicates that it uses GET in the test preview. cheers, blemmo
blemmo.. once again man.. you are the best always come to the rescue. you have no idea how frustrating I was. I have a question though.. so in my case, I should make 2 onLoad events? one is to receive and one is to send? I'm a little bit confused here. thanks alot blemmo, I really appreciate it
You're welcome. You don't need another load event, as long as myVars isn't loading anything. Here it's just used to send, and myVars_received is used as loader of the response. You could also use myVars as loading object, when the existing variables may be replaced by the loaded vars: myVars.sendAndLoad("http://localhost/gii_lite/display2.php", myVars, "POST"); Then of course you had to define myVars.onLoad to handle the response. greets, blemmo
ahh i got it.. thanks blemmo
Don't see what you're looking for? Try a search.
|