Skip to main content
Inspiring
July 4, 2009
Question

sendAndLoad

  • July 4, 2009
  • 2 replies
  • 983 views

Any ideas on why this does not work?...it should send and load Vars but it doesnt even trigger when complete...

thanks to any responders...

var postVars:URLVariables = new URLVariables();
postVars.userId='cat';
postVars.folderId='dog';
var request:URLRequest = new URLRequest();
request.url = "http://localhost/getSounds.php";
request.method = URLRequestMethod.POST;
request.data = postVars;

var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, completeHandler);

loader.load(request);

function completeHandler(event:Event):void
{testerText.text='triggered';}

This topic has been closed for replies.

2 replies

Inspiring
July 6, 2009

Do you have phpdev (or php server) running when you attempt to run the flash code?

Another thing, make sure your code is infact AS3 not AS2! I have attched a file that might help.

Inspiring
July 6, 2009

Thanks Kglad and nightwalker...

I have everything set up ok and am testing locally through my apache server:

anyway if i change the following line:

loader.dataFormat = URLLoaderDataFormat.VARIABLES;

to

loader.dataFormat = URLLoaderDataFormat.TEXT;

the script works fine... not sure why though?... thanks again J

Inspiring
July 7, 2009

One thing is variables are being called using "postVars"instead of VARIABLES! You are choosing what format you want for the loader, VARIABLES doesn't have a font, etc associated with it.

kglad
Community Expert
Community Expert
July 4, 2009

you may have a security problem.

add your flash folder to the trusted category:  http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html