Skip to main content
Participant
June 23, 2008
Question

LoadVars and loadVariables problem

  • June 23, 2008
  • 1 reply
  • 211 views
I'm having a little trouble with these two methods and can't find any information about this anywhere.

Basically, I have a flash movie which I need to communicate with a web server. I want to do this by passing values back and forth between the movie and a PHP script. Both will be hosted in the same place. On my development machine I have a php enabled web server running, and I test my stuff by changing the appropriate IPs/hostnames in flash and publishing the swf to the web folder and then testing it in firefox. Here's what my code looks like:

quote:

var testLoader = new LoadVars();
testLoader['testing123'] = "this is a test";
testLoader.sendAndLoad(" http://localhost/testscript.php", "_self", "POST");


This code is all in the root timeline. There is some supporting code in the next few frames which wait for the data to finish sending/loading before the movie continues. The thing is, I can get LoadVars.load() to work just fine like this, but I can't get .send or .sendAndLoad to work at all. The sever http logs come up empty, not even a request on crossdomain.xml. Is there something I'm doing wrong here?

Because of my troubles, I tried using loadVariables instead to send data to my PHP script using the "POST" parameter. It only seems to work when called from a button object, not a regular movie clip or the root timeline. When called from one of the latter two, it will simply do an http GET request instead. I can't find anything describing this behavior in the documentation so can anyone tell me why this is happening?
This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
June 24, 2008
use two different loadvars instances for the sending or the receiving loadvars. in no case would using "_self" work with loadvars.