我有一個flex應用程序,頂部分層的iframe。Iframe Javascript調用到Flex
我想調用iframe來使用javascript進行flex。
到目前爲止,我已經試過這樣:
這是包含在文檔根
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="IPRS_Dispatcher" width="1400" height="1000"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="DispatcherMain.swf" />
<param name="quality" value="high" />
<!-- <param name="bgcolor" value="${bgcolor}" /> -->
<param name="allowScriptAccess" value="sameDomain" />
<param name='flashVars' value='strLang=english&strIPRSSrvHost=&strGPSSrvHost=192.168.1.130&strGPSSrvSoapPort=8081&strGPSSrvFwdPort=26000&strLoginMode=simple&strSOSSrvHost=192.168.1.80&strSOSSrvSoapPort=8082&strSOSSrvFwdPort=26001&strSOSLoginMode=simple&strUserSIP=&strUserPswd=&nDelayForMapReadySecs=10&nGPSUpdatesRateSecs=120&nGPSSubscriptionsIntervalMinutes=10&nLat=35.0&nLng=32.5&nZoomLevel=5&strClientServiceVersion=2.1.36.19&nPathDotsSize=1&nPathWidth=5&bHideAnnounce=false&bHideEmergencyPan=true&strMapMarkerLabelMode=name&key=ABQIAAAAYbXZyR09wFj6QsiYucHpGxQEO34WZEWuIFq1A7yobGXPE-K5exQV9ZYR6NIkF8LCR8wsYvlhOIYsfA' />
<embed id="IPRS_Dispatcher2" src="DispatcherMain.swf"
flashVars='strLang=english&strIPRSSrvHost=&strGPSSrvHost=192.168.1.130&strGPSSrvSoapPort=8081&strGPSSrvFwdPort=26000&strLoginMode=simple&strSOSSrvHost=192.168.1.80&strSOSSrvSoapPort=8082&strSOSSrvFwdPort=26001&strSOSLoginMode=simple&strUserSIP=&strUserPswd=&nDelayForMapReadySecs=10&nGPSUpdatesRateSecs=120&nGPSSubscriptionsIntervalMinutes=10&nLat=35.0&nLng=32.5&nZoomLevel=5&strClientServiceVersion=2.1.36.19&nPathDotsSize=1&nPathWidth=5&bHideAnnounce=false&bHideEmergencyPan=true&strMapMarkerLabelMode=name&key=ABQIAAAAYbXZyR09wFj6QsiYucHpGxQEO34WZEWuIFq1A7yobGXPE-K5exQV9ZYR6NIkF8LCR8wsYvlhOIYsfA'
width="1400" height="1000" name="IPRS_Dispatcher" align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer"> <!-- bgcolor="${bgcolor}" -->
</embed>
</object>
我加入的addCallback爲我要揭露
ExternalInterface.addCallback("sendToFlash", callFromJavaScript);
功能在SWF嵌入對象
FYI
public function callFromJavaScript(str):void
{
LogAddItem(30, str);
}
以我IFRAME我已經添加了功能
function callToFlash(str)
{
var swf = parent.top.$("#IPRS_Dispatcher");
var bool = swf.sendToFlash(str);
}
立即得到錯誤在鉻 - 未捕獲的類型錯誤:對象[對象的對象]無方法
UPDATE 25/06/2012「sendToFlash」 - 從輸出的console.log(SWF)
[
<embed src="DispatcherMain.swf" width="100%" height="100%" align="middle" id="IPRS_Dispatcher" quality="high" name="IPRS_Dispatcher" wmode="opaque" allowfullscreen="true" allowscriptaccess="always" pluginspage="http://www.adobe.com/go/getflashplayer" flashvars="strOEM=mt&strSplashImage=./assets/loadinglogo.jpg&strLang=english&strSelectableLangs=english,chinese, portuguese_brazil,german,french,spanish&strIPRSSrvHost=85.118.26.10&strGPSSrvHost=85.118.26.16&strGPSSrvSoapPort=8081&strGPSSrvFwdPort=26000&strLoginMode=simple&strUserSIP=&strUserPswd=&strSOSSrvHost=85.118.26.17&strSOSSrvSoapPort=8082&strSOSSrvFwdPort=26001&strClientServicePort=&strSOSLoginMode=simple&themeColor=a7c3e3&showRTTPriority=false&showGPSUpdateRate=true&nSamePosErrMeters=300&nDelayForMapReadySecs=10&nGPSUpdatesRateSecs=65535&nGPSSubscriptionsIntervalMinutes=10&nLat=48.311058&nLng=11.636753&nZoomLevel=13.0&strClientServiceVersion=2.1.36.04&bDispatcherEndsSessions=true&nSOSSubscriptionsIntervalMinutes=1&GPSKATime=20&SOSKATime=20&nPathDotsSize=2&nPathWidth=5&bHideAnnounce=false&bHideEmergencyPan=false&bHideDebugLog=false&showMutedColumn=false&strLogFilter=&strMapMarkerLabelMode=name&key=ABQIAAAAfJEcVYS6-jYp2UOUy8Wh5xSCeXAFBxztfWxjY5w1WzTnKjnSVRS7Uu5XoOIwTg2R_tq_c0QSCPxSHw" type="application/x-shockwave-flash">
]
你可以把它放在什麼地方嗎?像保管箱或jsfiddle或託管?所以我可以幫助你調試? –
錯誤是Flex錯誤還是JavaScript錯誤? – JeffryHouser
JavaScript錯誤 –