2013-03-03 50 views
0

我創建了一個Flash文檔,然後我得到這個錯誤的Adobe Flash的ActionScript 3類型錯誤:錯誤#2007:參數孩子必須爲非空

類型錯誤:錯誤#2007:參數孩子必須爲非空。 在flash.display一::級DisplayObjectContainer/setChildIndex() 在VersiontwoFlashwebsite_fla :: MainTimeline/navOverF()

我不完全理解它所以任何幫助將是巨大的......這裏是我認爲的代碼錯誤舉行...

import flash.filters.GlowFilter; 
import flash.events.MouseEvent; 
import flash.display.MovieClip; 


var navBtnGlow:GlowFilter = new GlowFilter(0x999999,0.5,0,15,1,2,true,false); 
mc_navbar.addEventListener(MouseEvent.MOUSE_OVER, navOverF); 
mc_navbar.addEventListener(MouseEvent.MOUSE_OUT, navOutF); 
function navOverF(event:MouseEvent):void 
{ 
    event.target.filters = [navBtnGlow]; 
    mc_navbar.setChildIndex(event.target as MovieClip, 1); 
    dropdown.gotoAndStop(mc_navbar.getChildAt(1).name); 

} 
function navOutF(event:MouseEvent):void 
{ 
    event.target.filters = []; 
} 

回答

1

它看起來像是在

mc_navbar.setChildIndex(event.target as MovieClip, 1); 

因爲event.target拋出錯誤不是mc_navbar

孩子

您可能想使用您的調試器來檢查event.target所指的是什麼,並確保它是您的想法。

+0

當我檢查我得到這個錯誤.... [SWF] C:\用戶\ DIPAM \桌面\的Flash網站\ V3 \版本3個Flash website.swf - 解壓後 引發ArgumentError 14577個字節:錯誤#2025 :提供的DisplayObject必須是調用者的子項。 \t at flash.display :: DisplayObjectContainer/setChildIndex() \t at VersionthreeFlashwebsite_fla :: MainTimeline/navOverF()[VersionthreeFlashwebsite_fla.MainTimeline :: frame1:12] – DP187 2013-03-04 18:39:13

相關問題