【问题标题】:How to post php variables in swf?如何在 swf 中发布 php 变量?
【发布时间】:2014-02-27 03:42:24
【问题描述】:

我在 test.php 中有这个:

$domain = $_GET['domain'];
$user = $_GET['user'];

在我的动作脚本中我有:

getURL("http://test.com/file.php?domain=?&user=?", "_blank");

如何从 php 中获取变量并放入我的 swf 中?

我是 Flash 初学者!!!

【问题讨论】:

    标签: php flash actionscript


    【解决方案1】:

    将变量从 flash 发送到 PHP:

    //Actionscript:
    loadVariables ("test.php?myVariable=" + myFlashVar , _root);
    
    //PHP can retrieve it using
    $myVar = $_GET['myVariable'];
    

    要从 PHP 发送到 flash,使用完全相同:

    //Actionscript:
    loadVariables ("test.php?" , _root);
    
    //PHP:
    echo "&myVariable=hello";
    
    //Now in your flash movie, _root.myVariable will be equal to 'hello'
    

    我希望这足以让你开始:)

    【讨论】:

    • 应该如何:getURL("http://test.com/file.php?domain=?&user=?", "_blank"); ?
    • getURL 不允许您在后台发送变量。 getURL 将打开一个包含页面的新窗口。如果这是您真正想要的,那么您应该更改 ?在这里:-:--- getURL("test.com/file.php?domain=" + myDomain + "&user=" + myUser, "_blank"); 'myDomain' 和 'myUser' 将是 flash actionscript 中的变量。
    • 好的。带有两个变量的动作脚本如何,我应该在我的播放器代码中添加任何内容?
    • 只需使用绘图工具在舞台上放置一个文本框,并确保该文本框的名称为“input1”。然后添加到您的代码 myDomain=input1.text;您将获得信息。这应该足以让你开始。点击此链接获取教程以更深入地学习 actionscript:actionscript.org/resources/categories/Tutorials
    • 不知道是怎么做的!我是第一次做swf!你能为我做这个例子吗?谢谢!
    猜你喜欢
    • 2012-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-19
    相关资源
    最近更新 更多