Transfer data from Flash AS 3 to PHP

Ask a Question related to Macromedia Flash Data Integration, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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...
    2. 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....
    3. 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...
    4. Data transfer from SQL Server to DB2
      What do you mean by "details"? Larry "N. Jayasinghe" wrote:
    5. 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...
  3. #2

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139