2012-11-09 56 views
0

ActionScript代碼:調用swfobject的方法 - 不工作

import flash.external.ExternalInterface; 
var process = ExternalInterface.addCallback("process", this, Process); 
function Process(){ 
    avatar.process_loop.gotoAndPlay("loop"); 
} 

JavaScript代碼:

<div id="avatar"></div> 
<script type="text/javascript" src="swfobject.js"></script> 
<script type="text/javascript"> 
    swfobject.embedSWF("imgs/avatar.swf", "avatar", "170", "170", "9.0.0", "expressInstall.swf"); 
    swfobject.process(); 
</script> 

的SWF文件加載,我看到它的網頁上,只需連接或的調用方法不起作用。

順便說一下,一切工作都很好的瑞士法郎,該功能確實執行該「循環」。我的代碼有什麼問題嗎?

謝謝!

回答

1

swfobject是否引用了DOMElement?它需要引用元素,而不是任何其他構造函數/函數等。

你可以alert(typeof swf.process)如果我記得正確,看看它的功能與否。在此之前,你可以做swfobject.nodeType來查看它是否是一個實際的DOM節點。

編輯:

嘗試做:

document.getElementById('avatar').process() 

而不是

swfobject.process

+0

,我真的很抱歉,但我不知道一個DOMElement是什麼.. 。你問這是否是我的代碼/頁面上唯一的「swfobject」var/object ..如果是這樣,是的。 – ttothec

+0

對不起,延遲迴復,但它不起作用。 – ttothec

+0

此外,從您以前的請求,我得到了「未定義」這兩個警報... – ttothec