Skip to main content
Participating Frequently
June 16, 2006
Question

pb with sendAndLoad on buton....

  • June 16, 2006
  • 3 replies
  • 295 views
hello everybody !

I have a problem :

I've got this code on a button :

_root.infoVars.sendAndLoad(_root.server_path+"infocourses.php", _root.infoVars, " POST ");

and the var infoVars get nothing ... (saw in the debug)

On the other hand if i put this code in the root of my fla it's working ....
Why ? How can i do ? because i don't want to execute all requests at the beginning of my swf ....

Please help ....
This topic has been closed for replies.

3 replies

kglad
Community Expert
Community Expert
June 16, 2006
you're welcome.
kglad
Community Expert
Community Expert
June 16, 2006
show the code on your button.

p.s. i already think you'll have a problem getting any information to appear in your textfield if you're using its text property (and not its variable) because what you showed is not an onLoad handler.
pedromp7Author
Participating Frequently
June 16, 2006
oh sorry , yes it's a LoadVars but anyway that's my code on my button :
on (press){
_root.infoVars.sendAndLoad(_root.server_path+"infocourses.php", _root.infoVars, " POST ");
_root.infoVars.onLoad = function()
{
_root.info_loaded=1;
}
_root.cont.gotoAndStop("cours"); //cont is a movie clip
}

and this is the code of my frame "cours" where there is my dynamic textfield :
if(_root.info_loaded=1)
{
txt_cours_sche.htmlText=_root.infoVars.toto;
}
kglad
Community Expert
Community Expert
June 16, 2006
you have more than one problem.

first, if you want to test if _root.info_loaded is equal to 1, you need to use the double equal (==) in your if-statement.
second, you need to loop that if-statement in order to assign the htmlText property to your textfield.
third, you should define your onLoad handler BEFORE executing your sendAndLoad() statement.
and finally, you don't need any of the above if you use:

kglad
Community Expert
Community Expert
June 16, 2006
what's not working?

what code do you use to define infoVars? do you have an onLoad or onData handler for infoVars? are you having a problem with asynchronous transmission (because sendAndLoad() is asynchronous)?
pedromp7Author
Participating Frequently
June 16, 2006
what's not working is when i put the sendAndLoad function in my "onpress" event of my button
But if i put it outside of the code's button, then it's working...

My variable infoVars is a onLoad that define in the root of my fla like this :
infoVars = new LoadVars();
Shoud i use a onData object ??
Because actually , that i want to do is to get information from my database (mysql) when you push a button , to load this information in a dynamic textfield ...
thanks .....