2008-09-01 29 views

回答

5

您需要在HTML中使用「allowScriptAccess」Flash變量。您可能希望使用「sameDomain」作爲類型。請注意,如果你跨域,你還需要在服務器上託管一個名爲'crossdomain.xml'的特殊文件,這個文件可以啓用這樣的腳本(flash player會檢查這個)。更多的信息在http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14213&sliceId=2

這個調用是。最簡單的部分:-)在Flash代碼,你會使用ExternalInterface做的號召,作爲記錄在這裏:

http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001655.html

短版:你說

ExternalInterface.call (「javascriptFunction」,「參數」)

4

一個常見的方法是使用ExternalInterface類,您可以使用該類調用JavaScript方法。

首先定義你的JavaScript方法,例如:

<script language="JavaScript"> 
    function startsPlaying() 
    { 
     // do something when the FLV starts playing 
    } 
</script> 

然後修改您的ActionScript調用在適當的時候JavaScript方法:

// inform JavaScript that the FLV has started playing 
ExternalInterface.call("startsPlaying"); 

有關更多信息,請參閱相關的Flash CS3 documentation

2

,如果你不希望加載

import flash.external.*; 

所以你也可以做一個

getUrl("javascript:startsPlaying();"); 
相關問題