I’m trying to fetch some data from php to flash and print it in a dynamic text field. I know this might be a silly question but i cant seem to work out how to get flash to process the code text_field.text = data.return_msg; without it needing an event listener.
So i want the code to be processed as soon as flash discovers it basically.
this is what i have at the moment:
var variables:URLVariables = new URLVariables("get_blog_info.php");
// Build the varLoader variable
var varLoader:URLLoader = new URLLoader;
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
trace(varLoader);
var data:URLVariables = new URLVariables(event.target.data);
title_txt.text = data.return_msg;
}
and i get this error:
“1120: Access of undefined property event.”
I know its a basic question, but i’m new to flash so any help would be much appreciated.
Thanks
You need to actually listen to your loader in order to detect when it receives a response from PHP. Only then will you have an event object, and a populated data property. You should be doing something like this:
I’ve deliberately ignored your use of
URLVariablesas I believe you have misunderstood its purpose. You would create an instance of URLVariables with a string of name/value pairs, which are variables that will get sent to your PHP script. Since you don’t seem to be using any variables for the request I have ignored it