2013-05-18 69 views
0

試圖加載了我的文件中的SWF和我得到了以下錯誤:類型錯誤:錯誤#1034:類型強制失敗:

TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::[email protected] to flash.display.Loader. 
at flash.display::Sprite/constructChildren() 
at flash.display::Sprite() 
at flash.display::MovieClip() 
at ComicBook_003_fla::MainTimeline() 

這裏是我的代碼:

var loader:Loader = new Loader(); 
loader.load(new URLRequest("Avoider.swf")); 

loader.x = 100; 
loader.y = 100; 

addChild(loader); 
+0

這是在一個已經被加載到另一個SWF的SWF?你有你自己的可能會碰撞的名爲Loader的Class嗎? –

+0

是的,我做了,但我全部改了 – cameronjonesweb

+0

好吧,我一定錯過了一些東西,因爲我決定改變我提供的裝載機並且它工作正常 – cameronjonesweb

回答

0

看起來你在Avoider.swf中有一個錯誤,而不是你當前的代碼。你似乎在動畫片段上使用加載函數。

0

你試圖使用傳遞Loader作爲參數的addChild方法。嘗試使用加載器的「內容」屬性(即DisplayObject)。另外,請等到加載完成後再對您的內容採取任何措施。

相關問題