Skip to main content
Known Participant
May 12, 2010
Question

Tooltip to link elements

  • May 12, 2010
  • 2 replies
  • 693 views

Hello

I am trying to attaching tooltips to the link elements in my text flow.I added the roll over event listener with the link element and then trying to display the href of link element in the tool tip.

The problem is when I am trying to get the particular link element over which the mouse is rolling as evt.currentTarget as linkElement,it is null.When I try to check it using trace, the output was [Object eventDispatcher]. I am writing the few effect related lines of my code:

linkElement.addEventListener(MouseEvent.ROLL_OVER,applyToolTipToLink);

and after adding event, I am creating tooltip using

private function applyToolTipToLink(evt:Event):void{

     var linkElem:LinkElement = evt.currentTarget as LinkElement;

     spriteToolTip = ToolTipManager.createToolTip(linkElem.href,this.mouseX + 10,this.mouseY)as ToolTip;

}

Doesn't meet the required results and exception arise is "Cannot access a property or method of a null object reference."

Any Solution.

This topic has been closed for replies.

2 replies

Known Participant
May 13, 2010

hi

     In applyToolTipToLink method use "evt.flowElement" instead of  "evt.currentTarget".

Known Participant
May 13, 2010

Thats work great

thanks.

Known Participant
May 13, 2010

Hi

Any Solution?