Created a utility class for "a href" rollovers in html textfields - 

        
https://code.google.com/p/kurstcode/source/browse/trunk/libs/com/kurst/utils/TextFieldUtils.as

Might be a little buggy - needs some testing, seems ok so far... 

usage: 

import com.kurst.utils.TextFieldUtils

TextFieldUtils.addHTMLRollOver( label, htmlHrefEvent , this );

function htmlHrefEvent( dataItem : TextFieldDataItem ) : void {
                        
        trace('MouseOverStatus: ' + dataItem.overFlag + ' htmlHrefEvent: ' + 
dataItem.href )

}


Hope this helps someone...


- karim

On 15 Jun 2010, at 18:47, Karim Beyrouti wrote:

> TextEvents were a big improvement over asfunction (AS2 hack) - still - it 
> would be nice if TextEvent had listeners for link rollovers / rollouts. 
> 
> I like the fact you can still get to the url through using 
> textformat/getCharAtPoint.
> Tooltip data is stored in the link:  
>       <a href="event:http://www.url.com/#this is a tooltip"></a>
> So it's easily updatable.
> 
> thanks again.... very useful bit of code.
> 
> @ Henrik - Not used the TextLineMirrorRegion or the flash.text.engine - but 
> will look into it
> when i get some time - looks like that could provide the functionality for 
> rollover / rollouts.
> 
> http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/text/engine/TextLineMirrorRegion.html
> 
> Cheers
> 
> 
> - karim
> 
> 
> On 15 Jun 2010, at 17:24, Ktu wrote:
> 
>> Did you know that for htmlText using <a> you can specify the
>> href="event:myText"
>> Then register a TextEvent. This is how links inside of text fields can
>> trigger functions
>> 
>> http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/text/TextField.html#htmlText
>> 
>> Ktu
>> 
>> On Tue, Jun 15, 2010 at 12:14 PM, Karim Beyrouti <[email protected]> wrote:
>> 
>>> Yep... However I was trying to get roll overs to trigger a function. Am
>>> going to build a textfield roll over utility class... Will post the results
>>> here when it's done...
>>> 
>>> Thanks...
>>> 
>>> Karim
>>> 
>>> 
>>> 
>>> 
>>> On 15 Jun 2010, at 16:08, Kevin Newman <[email protected]> wrote:
>>> 
>>> a:hover works in a css style sheet:
>>>> 
>>>> var ss:StyleSheet = new StyleSheet();
>>>> ss.parseCSS("a:link{color: #0000FF;}a:hover{text-decoration:
>>>> underline;color: #FF0000;}");
>>>> var tf:TextField = new TextField();
>>>> tf.autoSize = TextFieldAutoSize.LEFT;
>>>> tf.styleSheet = ss;
>>>> tf.htmlText = '<p>A link: <a href="http://www.unfocus.com";>unFocus
>>>> Projects</a></p>';
>>>> addChild(tf);
>>>> 
>>>> 
>>>> Kevin N.
>>>> 
>>>> 
>>>> 
>>>> On 6/15/10 8:24 AM, Karim Beyrouti wrote:
>>>> 
>>>>> Hi All -
>>>>> 
>>>>> Wondering if there are any hacks to trigger a 'RollOver' script when
>>>>> hovering over a 'a href' link in an html textfield.
>>>>> Currently using TextEvent.LINK,to trigger links - but would like to show
>>>>> a tooltip on rollover (of that part of text).
>>>>> 
>>>>> So far the only solution i can think of is using :
>>>>> TextField.getCharIndexAtPoint(x:Number, y:Number)
>>>>> create this  - but it seems like this could be quite long winded
>>>>> solution.
>>>>> 
>>>>> Any other ways of achieving this?
>>>>> 
>>>>> 
>>>>> Thanks
>>>>> 
>>>>> 
>>>>> 
>>>>> Karim _______________________________________________
>>>>> Flashcoders mailing list
>>>>> [email protected]
>>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>>> 
>>>>> 
>>>> _______________________________________________
>>>> Flashcoders mailing list
>>>> [email protected]
>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>> 
>>> _______________________________________________
>>> Flashcoders mailing list
>>> [email protected]
>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>> 
>> _______________________________________________
>> Flashcoders mailing list
>> [email protected]
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 
> 
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to