Hello,
I have the following code:
for(var r in map.Region){
var region : MovieClip = getChildByName ('R' + map.Region[r].Id) as MovieClip;
region.id = map.Region[r].Id;
var tooltip : Tooltip = new Tooltip();
tooltip.x = region.x + (region.width + 120 - tooltip.width ) / 2;
tooltip.y = region.y + (region.height - 80 - tooltip.height ) / 2;
tooltip.id = "T" + map.Region[r].Id;
tooltip.mouseEnabled = false;
addChild(tooltip);
region.addEventListener(MouseEvent.MOUSE_OUT, Region_Out);
region.addEventListener(MouseEvent.MOUSE_OVER, Region_Over);
}
And I have the event for each region:
function Region_Over(e : MouseEvent) : void {
// Fade In Region
var tween:Tween = new Tween(e.currentTarget as MovieClip, "alpha", Strong.easeOut, 0.70, 1, 2, true);
// Show tooltip
var tooltip : MovieClip = getChildByName ('T' + (e.currentTarget as MovieClip).Id) as MovieClip;
tooltip.alpha = 100;
} // Region_Over
function Region_Out(e : MouseEvent) : void {
// Fade Out Region
var tween:Tween = new Tween(e.currentTarget as MovieClip, "alpha", Strong.easeOut, 1, 0.70, 2, true);
} // Region_Out
But now I would like the tooltip for each region to show when the mouse is over the correspondent region and to hide when the mouse is out of the correspondent region.
I added the Show Tooltip code inside the region mouse over even but I always get an error saying:
TypeError: Error #1009: Cannot access a property or method of a null object reference. at Map_fla::MainTimeline/Region_Over()
I am not sure what I am doing wrong … Any idea?
Thank You,
Miguel