# Tooltip. Relate two MC's

**URL:** https://forum.kirupa.com/t/tooltip-relate-two-mcs/304944
**Category:** flash
**Created:** [February 16, 2010, 11:49pm UTC](https://forum.kirupa.com/t/tooltip-relate-two-mcs/304944 "2010-02-16T23:49:39Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![shapper](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@shapper](https://forum.kirupa.com/u/shapper)
#### Post date: [February 16, 2010, 11:49pm UTC](https://forum.kirupa.com/t/tooltip-relate-two-mcs/304944/1 "2010-02-16T23:49:39Z")

</div>

Hello,

I have the following code:

```auto

  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:

```auto

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
