A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: PHP flash sendandload

  1. #1
    Junior Member
    Join Date
    Oct 2004
    Posts
    3

    PHP flash sendandload

    I'm brand spanking new to PHP. If I simply wanted to send back the variable I'm sending from flash, how would I do that?

    flash code

    var sendPacket:LoadVars = new LoadVars();
    sendPacket.test = "howdy";
    sendPacket.sendAndLoad("http://"+_root.HOST+"/swf/buyTestTicket.htmp", sendPacket, "POST");


    php
    echo "&testreturn=$POST['test']";

    I can echo testreturn if I send a string, so I know the flash side is working. How do I access the variable I send to PHP?

  2. #2
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,

    What do you mean?
    If you send a variable to the PHP script, you can store it in a variable and do what you want with it (email, store in a text file or database...)
    PHP Code:
    $myvar $POST['test'];
    // do what you want with the variable 
    But this is all...

    What else do you want to do?
    You may also send a variable back to flash:
    PHP Code:
    $myvar $POST['test'];
    if (
    $myvar == 'howdy')
    {
    echo 
    "&worked=yes&";
    }
    else
    {
    echo 
    "&worked=no&";

    And in flash have and onLoad() to receive the variable from PHP:
    code:

    sendPacket.onLoad = function(ok)
    {
    if(ok)
    {
    trace(this.worked);
    }
    else
    {
    trace("error");
    }
    };


    Read loading variables for more details.

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