flash sends a hello to php and php sends a hello to flash.

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Ajoo
New php-forum User
New php-forum User
Posts: 3
Joined: Mon Jan 07, 2013 1:48 am

flash sends a hello to php and php sends a hello to flash.

Postby Ajoo » Mon Jan 07, 2013 2:27 am

Hi all, As suggested by the subject, I have used Flash and php to exchange greetings between the two and i have done that successfully. However I am able to collect that value returned by php in a variable called mystr. The program does receive the greeting s and traces it in flash but that happens, I think, much too slow for flash to capture that value by its code here. Can someone help me and show me how may i get that value in the variable.

Please note that the flash stage is completely empty and no component need be placed on the stage.

The Flash code:

Code: Select all

path = "http://localhost/xampp"; //declare path to php files
var mystr:String;

var lv = new LoadVars();
lv.sendToPHP = "hello php";

lv.onLoad = function(success){
    if(success){
      trace("Value from php: "+this.fromPHP);
      mystr= this.fromPHP;
      }
}
trace("mystr= "+mystr);
lv.sendAndLoad(path+"helloFlash.php",lv,"GET");


The PHP code:

Code: Select all

<?php
if ($_GET["sendToPHP"] == "hello php")
{
    echo "fromPHP=hello flash";
}
?>

Return to “PHP coding => General”

Who is online

Users browsing this forum: Google [Bot] and 2 guests