SendAndLoad (php/flash)

Hi :slight_smile:

I canā€™t get this right :frowning:
Currently iā€™m sending a variable through get method from a php file to a swf file embedded in the php file. That is working:)
Then i want in flash to catch that variable and send it to another php file through post, and receive some info returned from the mysql db back in flash. I donā€™t think the php is the problem because the output is right.

I would really appreciate some help. Iā€™ve read several tutorials but this isnā€™t working.

So hereā€™s the actionscript:

function loadPostCard(id) {
    // Declare LoadVars object
    foto_ptl = new MovieClipLoader();
    var objEnvia:LoadVars = new LoadVars();
    objEnvia.postid=id;
    var objRecebe:LoadVars = new LoadVars();
    // when values are loaded
    objRecebe.onLoad = function(ok):Void  {
        if (ok) {
            // display variables text; in frame continue
            txtPostal.htmlText = this["texto"+0];
            txtData.htmlText = this["data"+0];
            txtSender.htmlText = this["sender"+0];
            imgFile = this["foto"+0];
            foto_ptl.loadClip("images/banners/pt/"+imgFile, foto_postal);
        }
    };
    objEnvia.sendAndLoad("postcard_fl.php", objRecebe, "POST");
    
}


if (id != undefined) {
    gotoAndStop("continue");
    function() {
        loadPostCard(id);
    }
}

Then i want in flash to catch that variable and send it to another php file through post, and receive some info returned from the mysql db back in flash. I donā€™t think the php is the problem because the output is right.

I have read this six times now, and it still isnā€™t clicking inā€¦ i need a coffee.

Ok. Sorry. English isnā€™t my mother language.

Iā€™m building a site that was supposed to be done in php, but it suddenly changed to flash so iā€™m learning in a real haste. The site (an hotel), among other stuff, allows the sending of postcards (a photo with a message). The mail that is sent is something like this ā€œX has sent you an email. Click here to view itā€, the link is something like index.php?id=123. In index.php if a query variable is defined itā€™s sent to the embedded swf file.

In the actionscript i detect if an id variable is defined and if it is, i send it (through sendandLoad) to postcard_fl.php to get the postcard that is being requested from the database. Upon the loading of the data i simply want to display the text and the photo.

Hope that was better :slight_smile:

Much better. But i donā€™t know how to do that:D I remeber reading about it but i donā€™t really do it that often so i never remember. Usually people want to be able to type something like: "http://www.somesite.com/someflash.swf&name=jimmy"
Then the flash comes up and says ā€œHi Jimmy!ā€. Kinda the same thing. Iā€™ll do some Kirupa power searching for ya.:slight_smile:

Ok :slight_smile: Thanx.

My php output string is this:

$var_url .= "&postid$n=".$row[0]."&sender$n=".$row[2]."&texto$n=".$row[4]."&data$n=".$row[5];

And hereā€™s my php code (part):

if(isset($_POST['postid']) && is_numeric($_POST['postid'])){
    $postid = $_POST['postid'];
    $results = get_postcard($postid);
    $n = 0;
    foreach ($results as $row){
        $phoid = $row['phoid'];
        $photo = get_photo($phoid);
        $var_url .= "&postid$n=".$row[0]."&sender$n=".$row[2]."&texto$n=".$row[4]."&data$n=".$row[5];
        foreach ($photo as $pic){
            $var_url .= "&foto$n=".$pic[1];
        }
          $n++;
    }
    // add a value with the number of total items
    $var_url .= "&tamanho=$n";
    
    // code the string to utf-8 and print it
    print utf8_encode($var_url);

}

Please please help. I really canā€™t get this to work :frowning: