all groups > flash actionscript > march 2006 >
You're in the

flash actionscript

group:

sendAndLoad issue


sendAndLoad issue The 350Z
3/16/2006 11:45:30 PM
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");
Re: sendAndLoad issue blemmo
3/17/2006 2:46:27 AM
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
Re: sendAndLoad issue The 350Z
3/17/2006 2:53:38 AM
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


Re: sendAndLoad issue blemmo
3/17/2006 3:06:13 AM
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
Re: sendAndLoad issue The 350Z
3/17/2006 3:40:20 AM
ahh i got it.. thanks blemmo
AddThis Social Bookmark Button