I new with flash and I really don’t know what is the reason I get this error:
TypeError: Error #2007: Parameter text must be non-null.
at flash.text::TextField/set text()
at sgmap_fla::MainTimeline/mapOver()
my actionscript:
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});
}
Text field text cannot be null.
Specifically this error is caused by setting a text field
textproperty tonull. This can be replicated withTextFieldClassic Text:Classic Text:
This will throw the error your cited:
TLF Text does not have this issue, and may be set to null.
Per your implementation, this occurs within your
mapOver(e:MouseEvent)function. EithermapItem.countryNameormapItem.zoneare null. It’s likely they are both null.Mouse events do not seem to be dispatched from the scope you expect. You have a listener on
map_mc:It looks like you’re expecting this event from any of the following movie clips:
northZone,centralZone,eastZone,westZone, andsouthZone. These symbols have the properties you are looking for; however, map_mc does not.So, root cause is that your event listener
e.targetis not the symbol you are expecting.Verify what symbol
e.targetis. It’s probablymap_mcwhich does not have the properties you are expecting:You’re looking for those properties on a child of
map_mc: