0
我有一個基於用戶交互生成xml的flash/flex對象。 我想傳遞一個XML字符串到JavaScript,以便它可以進行Web服務調用。如何在Flash和javascript之間傳遞數據
如何將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從閃存獲取XML /柔性
var flashObject = document.contentWindow.getFlashObject();
flashObject.saveXml();
var xmlFromFlex = flashObject.savedXML; /*This is where I don't know how to get/set*/
我試圖從閃存中獲得的價值
更多的信息,這似乎只能夠傳遞一個值閃爍。 – Brian
Brian ......他給了你正確的答案......'JsTestFunction'是你想要調用的HTML頁面中JavaScript函數的名稱。 ExternalInterface.call將調用頁面上的該函數並將結果返回到Flash。 –
因此, 中的第二個參數('Work_Damn_It')JSvalue = ExternalInterface.call('JsTestFunction','Work_Damn_It'); 是JavaScript方法中的第一個參數值? – Brian