WebプログラミングU Flashとの連携

2006/6/26       学籍番号               名前                         |

基本パターン  例 鸚鵡返しスクリプト

Flash側   PHP側 send_load_test.php
System.useCodepage = true;
sendV = new LoadVars();
loadV = new LoadVars();


send_mc.onPress = function(){
    sendV.name = name_txt.text;
    sendV.msg = msg_txt.text;
    sendV.sendAndLoad("send_load_test.php",loadV);
    loadV.onLoad = recieveFunction;
}

function recieveFunction(success) {
    if(success) {
        name2_txt.text = loadV.n;
        msg2_txt.text = loadV.m;
    } else {
        msg2_txt.text = "読み込みエラー";
    }
}
→→
 
←←
<?php
$name=$_POST['name'];
$msg=$_POST['msg'];

print "n=".$name."&m=".$msg;
?>

name_txt
富士山太郎
msg_txt
PHPは面白い。
ActionScriptも面白い。
 
send_mc
 
name2_txt
        |
msg2_txt
               |