flash与php交互学习笔记
flash与php脚本相结合实现页面动态无刷新
或者是flash通过php脚本间接与数据库交互
等等,在次基础上可以继续深入及扩展
下面是flash与php的简单交互
1)flash文档loadvarfromphp.swf
文档里包含三个文本框及一个按钮
三文本框:user_name(输入文本格式),user_age(动态文本格式),user_sex(动态文本格式),button控件
2)php脚本
if($_GET['name'] == 'songxinfeng')echo("age=20&sex=boy");
if($_GET['name'] == 'lirui')echo("age=18&sex=girl");
else {
echo("age=undefined&sex=undefined");
}
?>
if($_GET['name'] == 'lirui')echo("age=18&sex=girl");
else {
echo("age=undefined&sex=undefined");
}
?>
3)设置button控件的动作
on (release) {
system.useCodepage = true;
loadVariables("http://127.0.0.1/get.php?name="+this._parent.user_name.value,this._parent);
}
system.useCodepage = true;
loadVariables("http://127.0.0.1/get.php?name="+this._parent.user_name.value,this._parent);
}
this._parent表示按钮的父层
loadVariables函数将用户输入的user_name值传送给http://127.0.0.1/get.php,php脚本
,脚本再将符合用户输入user_name的age,sex返回给flash脚本
4)php脚本返回的变量之间要用&隔开
转:http://blog.chinaunix.net/uid-20240947-id-108691.html