tags:

views:

126

answers:

1

in flash how to give a link on static text with the mouse over=underline effect....

please reply....

+2  A: 

Adding hyperlinks to a static text is not straightforward as in the case of a normal text field because

  • StaticText doesn't have htmlText property like a TextField - it inherits directly from DisplayObject.
  • You cannot mimic it by listening to mouse events as DisplayObject doesn't dispatch mouse events - only an InteractiveObejct would dispatch mouse/keyboard events.
  • There is no graphics property for a DisplayObject, hence you cannot mimic underlining behavior.
  • The authoring tool may export multiple text field objects comprising the complete text. For example, for vertical text, the authoring tool will create one text field per character.

May be you can work around these limitations by wrapping the static text inside a Sprite - but I would use a TextField instead of reinventing the wheel.

Amarghosh
I'm checking into this now, +1 but I hope this is not right :)
Yar
Be sure to check out http://www.kirupa.com/forum/showthread.php?p=1957523 for how to add links to text.
Yar
@yar does it say anything about adding hyperlinks on StaticText?
Amarghosh
@Amargosh, no: however, why do you care whether it's static or dynamic text? The only advantage is the formatting. So while it's amazingly roundabout, you take your static text, convert it to HTML, and plug it in using ActionScript and then you can have links in it. I do not think the question really required it to be StaticText (though it says that).
Yar