View Full Version : Trouble with link events

10-06-2010, 04:02 AM
Im creating text links with as3 for the first time and want to add some extra interactivity, animation etc on button hovers, clicks etc etc.

so far I have text setup as follows (simplified)

import flash.text.StyleSheet;
import flash.events.TextEvent;

var jeffText:TextField = new TextField()
jeffText.htmlText = "<a href='http://site.com/'>http://site.com/</a>"; //note for link to be ACTIVE it needs to be HTML formatted HERE
jeffText.x=33; jeffText.y=802;
jeffText.width=150; jeffText.height =21;

var LowerBoxStyleCSS:StyleSheet = new StyleSheet();
LowerBoxStyleCSS.setStyle("a:link", {color:'#32CCFF', textDecoration:'none', fontSize:'13', fontFamily:'verdana'});
LowerBoxStyleCSS.setStyle("a:hover", {color:'#32FFFF', textDecoration:'none'});

jeffText.styleSheet = LowerBoxStyleCSS;


The above works for my simple links. Via another sites tutorials I am trying to add some simple effects on hovers or buttons clicks but cant get it to work and need some help... The below code is what im trying to use..

jeffText.addEventListener(TextEvent.LINK, linkHandler);

function linkHandler(linkEvent:TextEvent):void {

//STUCK HERE.. tried manipulating linkEvent.text without success
//simple eg to test would be, jeffText.x =- 5 on hover

thanks in advance