我有一个基于用户交互生成 xml 的 flash/flex 对象。我想将一个 xml 字符串传递给 javascript,以便它可以进行 Web 服务调用。
如何将 XML 传递回 Javascript?
例子:
html:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"
id="My">
<param name="movie" value="My.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
</object>
初始化的javascript
var swfVersionStr = "10.2.0";
var xiSwfUrlStr = "playerProductInstall.swf";
var flashvars = {};
var attributes = {};
flashvars.servicePath = "services/";
flashvars.isSaved = "false";
flashvars.savedXML;
var params= {
quality = "high";
bgcolor = "#ffffff";
allowscriptaccess = "sameDomain";
allowfullscreen = "true";
wmode = "transparent";
};
swfobject.embedSWF(
"My.swf", "flashContent",
"100%", "100%",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
Javascript 从 flash/flex 获取 XML
var flashObject = document.contentWindow.getFlashObject();
flashObject.saveXml();
var xmlFromFlex = flashObject.savedXML; /*This is where I don't know how to get/set*/