A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Data from FlashLite 1.x to server!

  1. #1
    Senior Member vinayak.kadam's Avatar
    Join Date
    Oct 2006
    Location
    gotoAndPlay("Pune");
    Posts
    831

    Data from FlashLite 1.x to server!

    I basically work with flash MX/MX 2004. Recently I updated my knowledge to FlashLite 1.x

    Well my query is if I have to send some data from flashlite to any other server, what all alternatives I have ? Looking at the FlashLite 1.x help, I can only see LoadVars which can just read data from a text file and it is the only one which can post HTTP parameters. Is there any other option available....?
    As ever,
    Vinayak Kadam

  2. #2
    Registered User
    Join Date
    Apr 2001
    Location
    Akron OH, USA
    Posts
    4,841
    you probably mean loadVariables which is a flash 4 feature. LoadVars is a Flash 6 object not supported in Flash Lite 1.1.

    You can use loadVariables to send data to the server. This function will send all the variables from the current movie clip to the specified url as HTTP name value pairs. Use the "GET" method as there seems to be problems with "POST" in FL1.1

    You can test things on the server side by printing all HTTP variables.

    ActionScript for FL1.1
    var1 = "value1";
    var2 = "value2";
    // send all variables from this movie clip to the specified url
    loadVariables("someurl.php","POST");

    PHP:
    print_r($_REQUEST);

  3. #3
    Senior Member
    Join Date
    Aug 2006
    Posts
    322
    Thank You Vin....
    As u ask, from flash lite u can post any file which a server site program can handle with flash (example: asp, php, cgi, etc) and with C#, java python language.
    as a question of database mysql is my favorite. Excel, Access on the other hand for a handy application.

    marlopax

    Sorry if I did mistakes

  4. #4
    Senior Member vinayak.kadam's Avatar
    Join Date
    Oct 2006
    Location
    gotoAndPlay("Pune");
    Posts
    831
    Oh great response from both of you marloplax and hp3.

    Thanks once again!
    As ever,
    Vinayak Kadam

  5. #5
    Registered User
    Join Date
    Apr 2001
    Location
    Akron OH, USA
    Posts
    4,841
    one thing to be aware of with loadVariables() is that it will send ALL variables from the current movieclip (the one containing the loadVariables() function call).

    You may end up sending much more data than you need making the connection more expensive and slower for the end user.

    One way to avoid this is to set only the variables you need to send in a "data" movie clip. This clip acts as a container for the data you intend to send and recceive. YOu can use gotoAndPlay() a frame in the data mc containing a loadVariables() or the call() function.

    On the receiving end, Flash will automatically parse HTTP name value pairs as they download. Therefore you can track load progress by setting up your server side process to set a status variable to false at the beginning of the name value pair list and true at the end.

    ex php:

    echo "status=loading&var1=value1&var2=value2&status=com plete";

    Use a frame loop to check the status variable to determine when Flash Lite has finished loading data.
    Last edited by hp3; 11-18-2008 at 11:23 AM.

  6. #6
    Senior Member vinayak.kadam's Avatar
    Join Date
    Oct 2006
    Location
    gotoAndPlay("Pune");
    Posts
    831
    Ya...thats seems very logical hp3!
    As ever,
    Vinayak Kadam

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center