I canāt get this right
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.
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.
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.
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);
}