Ask a Question related to Macromedia Flash Data Integration, Design and Development.
-
lukegatos #1
Transfer data from Flash AS 3 to PHP
I have coded a program to accept several text fields in Flash and then transfer
them (using a defined Class function, sendExample with sendPhp) and display
them with a pfp form. When I run the swf from my pc it transfers the data
correctly (the php file is on my hosted server.) However when I transfer the
swf to the server (along with the class I defined to do the transfer), the php
file is called but no data is transfered. What is missing from the server to
make the data transfer complete? No errors, just a php page with no data
inserted.
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.*
import flash.net.*;
import flash.net.URLVariables;
var sendPhp:sendExample = new sendExample();
function sendToPhp(evt:MouseEvent):void {
var formUrl:String = "http://'mydomain'/message_form.php"
var formData:URLVariables = new URLVariables();
formData.message1= this.message1.text;
formData.message2= this.message2.text;
formData.message3= this.message3.text;
formData.message4= this.message4.text;
formData.message5= this.message5.text;
formData.remoteSystem = this.remoteSystem.selectedItem;
sendPhp.submitData(formUrl, formData);
}
submit_btn.addEventListener(MouseEvent.CLICK, sendToPhp, false, 0, true);
********************************************
//class definition sendExample
package {
import flash.display.MovieClip;
import flash.text.TextField;
import flash.events.*;
import flash.net.*;
public class sendExample extends MovieClip {
public function sendExample() {}
public function submitData(url:String, _vars:URLVariables):void {
var request:URLRequest = new URLRequest(url);
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
request.data = _vars;
request.method = URLRequestMethod.POST;
loader.addEventListener(Event.COMPLETE, handleComplete);
loader.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
loader.load(request);
navigateToURL(request);
}
private function handleComplete(event:Event):void {
var loader:URLLoader = URLLoader(event.target);
trace("Par: " + loader.data.par);
trace("Message: " + loader.data.msg);
}
private function onIOError(event:IOErrorEvent):void {
trace("Error loading URL");
}
}
}
lukegatos Guest
-
How do I transfer data from one pg to the next pg?
I have a registration page that I would like to go to a welcome page when registration is complete. The welcome page will say "Welcome (name) your... -
data transfer to and from flash and asp
hello friends; i'm currently designing a website and i want to know how to send data from flash application to an asp page and recieve back in flash.... -
Data transfer
I'm still very new to .NET. I managed to write a web service using managed extensions for C++ and integrate it with existing business logic. The... -
Data transfer from SQL Server to DB2
What do you mean by "details"? Larry "N. Jayasinghe" wrote: -
transfer data from WS to PC via USB key/flash-drive memory
Hello all, WorkStation with Solaris. Windoze or Linux PC. Has anyone been able to transfer data between them by using a USB key or USB... -
lukegatos #2
Re: Transfer data from Flash AS 3 to PHP
Another detail about the problem - the php page only works correctly when I run
the Flash movie using the Flash CS3 Application program (ctl + Enter). When I
just open the Flash movie using a browser, the php page is called but again no
data is transferred to the form.
lukegatos Guest



Reply With Quote

