Php TO Flash
I'm sure that I just haven't come across the right article yet, but I can't seem to find a decent tutorial addressing sending a PHP variable to Flash. I definitely have looked, but haven't come up with a working solution. In my PHP file, I declare a variable with content from a MySql database. I know for sure that going from the database to PHP works, but I'm not sure how to reach that variable and display it in Flash. Right now, here is my code:
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, varsLoaded);
loader.load(new URLRequest("reciever.php"));
var varToAppend:String = "";
function varsLoaded(e:Event):void
{
varToAppend = e.target.data.all_content.toString();
all_txt.text = String(varToAppend);
}
all_content is my variable I'm trying to reach. But when I run my program, it comes up with this error:
TypeError: Error #1010: A term is undefined and has no properties.
at Base_fla::MainTimeline/varsLoaded()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
This is the line it does not like:
varToAppend = e.target.data.all_content.toString();
When I take out the .toString(); it shows null. Does any one have any suggestions with more productive code?
Thank you, Alex.
