Php 将变量加载到Flash(AS3)中直到HTML标记弹出
我正在用flash开发一个小博客应用程序,似乎无法加载任何嵌入html的变量。有办法解决这个问题吗? 闪存代码:Php 将变量加载到Flash(AS3)中直到HTML标记弹出,php,flash,actionscript-3,Php,Flash,Actionscript 3,我正在用flash开发一个小博客应用程序,似乎无法加载任何嵌入html的变量。有办法解决这个问题吗? 闪存代码: var urlLoader:URLLoader = new URLLoader(new URLRequest(path + "index.php")); urlLoader.addEventListener(Event.COMPLETE, showData); function showData(e:Event):void { var dataObj:URLVariable
var urlLoader:URLLoader = new URLLoader(new URLRequest(path + "index.php"));
urlLoader.addEventListener(Event.COMPLETE, showData);
function showData(e:Event):void
{
var dataObj:URLVariables = new URLVariables( e.target.data );
trace(dataObj.title); // would traces fine
trace(dataObj.content); // throws error
}
index.php是:
<?php
$results = "title=this is my title and will print fine";
$results .= "&content=This will cause an error <b>Because of these html tags</b>";
print $results
?>
(类似于json_编码)
谢谢你的意见。
-J您可以尝试PHP脚本中的变量。
然后,你可以使用内置闪光灯(或者也可以?)
使用AMFPHP,您可以向flash发送类型持久性对象,而不仅仅是字符串
此外,您还可以使用JSON,有些库(例如)为FLAH提供JSON解码。就个人而言,对于复杂的结构,我强烈避免使用URLVariables。XML(+CDATA)或JSON肯定更适合于此。同意,但我要补充一点,如果您自己提供AMFPHP或类似服务,则会更好。更快的传输和结果中的类型化对象很酷。但是对于小东西xml/JSON。。。
flash_encode($myVar);