-
Issue when calling a remote PHP file from Flash
Hi all.
I've run into a problem that's throwing me for a loop and I'm hoping someone can offer some insight. I'm creating a Mac/Win projector using Flash which is supposed to retrieve data from a database by calling a PHP file and returning data. Locally this works exactly as it should. However, when I attempt to call the php file from a remote location, it's not returning any data when the Event.Complete event listener fires. Since it works locally and not remotely, I'm thinking it's firing before the data has been received, but if that's the case I don't know how to fix it. Any help would be great.
Here's a snippet of the relevant code:
Code:
var phpLoader:URLLoader = new URLLoader();
var phpVars:URLVariables = new URLVariables("return=true");
var phpRequest:URLRequest = new URLRequest("http://..somefile.php");
phpRequest.method = "post";
phpRequest.data = phpVars;
phpLoader.dataFormat = "variables";
phpLoader.addEventListener(Event.COMPLETE, onReturn);
phpLoader.load(phpRequest);
function onReturn(e:Event):void{
trace("data: "+e.currentTarget.data); //Returns = "data:"
}
-
.
Hi,
Try
PHP Code:
phpLoader.dataFormat = URLLoaderDataFormat.TEXT;
It works with my testing here, using exe projector.
If you have major problems then you will need to attach your files.
Last edited by fruitbeard; 07-30-2015 at 01:28 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|