我新的閃光燈和我真的不知道什麼是我得到這個錯誤的原因:類型錯誤:錯誤#2007:參數文字必須爲非空
TypeError: Error #2007: Parameter text must be non-null.
at flash.text::TextField/set text()
at sgmap_fla::MainTimeline/mapOver()
我的動作:
description.countryName_txt.text = "";
description.zone_txt.text = "";
map_mc.buttonMode=true;
map_mc.addEventListener(MouseEvent.MOUSE_OVER, mapOver);
map_mc.addEventListener(MouseEvent.MOUSE_OUT, mapOut);
map_mc.northZone.countryName = "Singapore";
map_mc.northZone.zone = "North Zone";
map_mc.centralZone.countryName = "Singapore";
map_mc.centralZone.zone = "Central Zone";
map_mc.eastZone.countryName = "Singapore";
map_mc.eastZone.zone = "East Zone";
map_mc.westZone.countryName = "Singapore";
map_mc.westZone.zone = "West Zone";
map_mc.southZone.countryName = "Singapore";
map_mc.southZone.zone = "South Zone";
function mapOver(e:MouseEvent):void{
var mapItem:MovieClip = e.target as MovieClip;
description.countryName_txt.text = mapItem.countryName;
description.zone_txt.text = mapItem.zone;
description.gotoAndStop(mapItem.name);
TweenMax.to(mapItem, .5, {tint:0xFF9900});
TweenMax.fromTo(description, .5, {alpha:0, x:50, blurFilter:{blurX:80}}, {alpha:1, x:10, blurFilter:{blurX:0}});
}
function mapOut(e:MouseEvent):void{
var mapItem:MovieClip = e.target as MovieClip;
TweenMax.to(mapItem, .5, {tint:0x990000});
}
文本字段的文本不能設置爲null。這可以通過在設置文本字段之前跟蹤'countryName'和'zone'的'mapItem'屬性來確認:'trace(mapItem.countryName); trace(mapItem.zone);''從'mapOver'事件處理函數中,'mapItem'看起來不是包含這些屬性的區域。 – 2012-07-09 05:57:20
嗨賈森,它似乎並不工作,雖然我改變了: 'description.countryName_txt.text = mapItem.countryName; description.zone_txt.text = mapItem.zone;' 至 'description.countryName_txt.text = trace(mapItem.countryName); description.zone_txt.text = trace(mapItem.zone);' – kokloong 2012-07-10 00:52:29