Flash display php echo message?
- Started
- Last post
- 13 Responses
- boobs
How do I get this to happen in AS 3.0?
I just want a wee text box that displays the php echo message...
- ********0
stop making new threads
- acescence0
are you echoing the message at the time the swf is being embedded, or is the swf sending out data and receiving this response?
- ********0
show your boobs and we'll help.
- acescence0
ok i saw your OTHER thread.
google URLLoader
- boobs0
I'm sending the data to the php to the mySQL fine. I've got that working.
Do I have to make a new, additional URLLoader just to pick up the echo?
- chrisRG0
are you loading the 'echo' php message via xml in your flash?
- boobs0
If I can skip using the xml step, that would be great.
I just want a text field I have, txtInfo, to display the string that the echo puts out.
- chrisRG0
var loader:URLLoader = new URLLoader();
var request:URLRequest = new URLRequest( "yourFile.php" );
loader.addEventListener(Event.CO... onComplete);
loader.load(request);
var loader:URLLoader = URLLoader(event.target);
your_txtfield.text = loader.data;you can get more details here, if you want to load specific vars:
http://livedocs.adobe.com/flash/…
- noiseisthis0
whaaa? why create another instance of the urlloader if you already have one on line 1?
and the event handler has to run a method (onComplete):
function onComplete(event:Event):void
{
your_txtfield.text = loader.data;
}
- sixfngers0
just make sure your return values dont have a & as the first or last char i used to always return values to flash as &name-value or name-value& that way i could just tack on as many as needed for that instance but as3 no likey that took me forever to figure that one out.
- boobs0
So I added this to my script, and the textfield stays blank!!
private function messageSent(event:Event):void
{//from QBN acvice
var loader1:URLLoader = URLLoader(event.target);
var request1:URLRequest = new URLRequest( "myForm.php" );
loader1.addEventListener(Event.C... onComplete);
loader1.load(request1);function onComplete(event:Event):void
{
txtInfo.text = loader1.data;
};It doesn't seem to do a thing!
}
- sixfngers0
not sure what your php is returning but if you are returning name value pairs you have to set the dataFormat to variables otherwise
loader1.dataFormat = 'variables'
//(the default is 'text')
