从PHP Flash影片请求的数据,在运行时 [英] Request data in a Flash movie from PHP, at run-time

查看:181
本文介绍了从PHP Flash影片请求的数据,在运行时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能要求的一些数据,从PHP Flash影片在运行时?也许我的现实世界的实现可以澄清一些事情:

Is it possible to request some data in a Flash movie from PHP at run-time? Maybe my real-world implementation can clarify some things:

我用的Flash影片来存储本地共享对象(因为某种原因,我需要LSO的替代或常规PHP饼干)。 现在,当我加载了一个PHP文件,我想以某种方式检索来自莱索托的数据在运行时,将其分配给一些变量,并通过脚本的其余部分使用的变量。

I use a Flash movie to store a Local Shared Object (because for some reason I need LSO's instead or regular PHP cookies). Now, when I load up a PHP file I want to somehow retrieve the data from the LSO at runtime, assign it to some variables, and use the variables through the rest of the script.

做一些研究使我相信这是不可能的,我打算的方式。因此,任何其他建议,方法或解决方案是非常欢迎的。

Doing some research makes me believe it's not possible in the way I intend. So any other suggestions, methods or solutions are highly welcome.

推荐答案

,以实现它的Flash和PHP的XML的最好方法(不要忘了使用UTF-8!)。

The best way to intercommunicate Flash and PHP is XML (don't forget to use UTF-8!).

在PHP中:

$xml = new DOMDocument('1.0', 'UTF-8');
$doc = $xml->appendChild($xml->createElement('my-root-element'));
...
header('Content-Type: text/xml; charset=utf-8');
echo $xml->saveXML();

在AS3

var myLoader:URLLoader = new URLLoader();
var req:URLRequest = new URLRequest('http://host.com/my_xml.php');
myLoader.addEventListener(Event.COMPLETE, onMyXMLLoad);
myLoader.load(req);

function onMyXMLLoad(evt:Event)
{
    trace(evt.target.data);
    var xml:XML = new XML(evt.target.data);
    ...
}

您也可以了解有关 ExternalInterface的 ......是的,有时它可以帮助...你可能要产生dynamicaly您的JS与Flash动画进行沟通。

You could also read about ExternalInterface... Yes, sometimes it helps... You may want to generate dynamicaly your JS to communicate with flash movie.

这篇关于从PHP Flash影片请求的数据,在运行时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆