PDA

View Full Version : sendAndLoad



VoS
March 27th, 2005, 01:08 PM
hey there , i have a small dilemma...
i want to send and load a few variables, im using this code...

submit.onPress = function(){
if(password1.text==password2.text){
status1.text="submitting...";
var l = new LoadVars();
l.user = username.text;
l.pass = password1.text;
l.email = email.text;
trace(l);
l.sendAndLoad('http://xew.mine.nu/script/createuser.php', '_blank', 'POST');
l.onLoad = function() {
trace("loaded");
status1.text="registered";
}
}else{
status1.text="passwords dont match";
}
}

now the problem lies in this
find the line with this on it
l.sendAndLoad('http://xew.mine.nu/script/createuser.php', '_blank', 'POST');
if i place just
l.send('ht.....
it sends the variables...
but i also want to retrieve some variables , and most importantly know when the variables have been sent whihc i belive you can do with
l.onLoad = function() {
i hope ;)
now why cant i sendAndLoad just send? what is it im missing
(this is kinda newish territory for me)

thanks
//Vos

P.S. there is no problem in my .php file the variables are sent to my mysql database if i just use send

virusescu
March 27th, 2005, 01:16 PM
Because that's NOT the correct sintax for sendAndLoad ;);
This should work check it out.
I used a different object although you can use the same sharedObject for recieving the datas.


submit.onPress = function () {
if (password1.text == password2.text) {
status1.text = "submitting...";
var ld = new LoadVars ();
var reciever = new LoadVars();
ld.user = username.text;
ld.pass = password1.text;
ld.email = email.text;
trace (ld);
ld.sendAndLoad ('http://xew.mine.nu/script/createuser.php', reciever, 'POST');
reciever.onLoad = function () {
trace ("loaded");
trace("Recieved info -> "+reciever);
status1.text = "registered";
};
} else {
status1.text = "passwords dont match";
}
};



Good luck ;)

VoS
March 27th, 2005, 01:19 PM
thanks, works like a dream (offcourse =P )


//VoS

maxray
April 13th, 2005, 05:20 AM
What do you have to put in your asp or php script to send back to the flash?

I want to send som e variables from flash to a page which creates a text file. Obviously I dont want the user to see the asp page so want to use sendandload rathe rthan just appending the variables to a geturl.

I just dont understand how the asp page tells the flash its recieved them.

Any help or pointers to a solution appreciated.

:)

maxray
April 13th, 2005, 05:24 AM
Having rechecked my coed i was being hasty and it does actually seem to work.. cheers :$

:cyborg:

Dutchy
April 13th, 2005, 05:25 AM
in php use the echo command and it sends information to flash...

Dutchy