[Flashcoders] HTML TextFields - 'A HREF' RollOvers..

2010-06-15 Thread Karim Beyrouti
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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] HTML TextFields - 'A HREF' RollOvers..

2010-06-15 Thread Glen Pike

Why not use the mouse coordinates?

On 15/06/2010 13:24, 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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


   


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] HTML TextFields - 'A HREF' RollOvers..

2010-06-15 Thread Ktu
This in a mouseMove or enterFrame event is what I've always used.


var index = txt.getCharIndexAtPoint (txt.mouseX, txt.mouseY);
var url = ;
if (index = 0) {
var fmt:TextFormat = txt.getTextFormat (index, index + 1);
if (fmt.url) url = fmt.url;
}
if (url) {
// begin tooltip code
}

ktu


On Tue, Jun 15, 2010 at 8:49 AM, Glen Pike g...@engineeredarts.co.ukwrote:

 Why not use the mouse coordinates?


 On 15/06/2010 13:24, 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
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders





 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] HTML TextFields - 'A HREF' RollOvers..

2010-06-15 Thread Karim Beyrouti
The HREF link is only part the the textfields content, and each textfield can 
have more than one link amongst other copy
and need to show relevant tooltip only when user is hovering over the 'a HREF' 
parts of the html textfield.

On 15 Jun 2010, at 13:49, Glen Pike wrote:

 Why not use the mouse coordinates?
 
 On 15/06/2010 13:24, 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
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 
   
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] HTML TextFields - 'A HREF' RollOvers..

2010-06-15 Thread Ktu
sorry, I tacked on that last if statement. It should probably read

if (url.length  0) {
// begin tooltip code
}

maybe you want to check if its an appropriate web url with a regExp first,
but I think you get the idea.

Ktu

On Tue, Jun 15, 2010 at 9:05 AM, Ktu ktu_fl...@cataclysmicrewind.comwrote:


 This in a mouseMove or enterFrame event is what I've always used.


 var index = txt.getCharIndexAtPoint (txt.mouseX, txt.mouseY);
 var url = ;
 if (index = 0) {
 var fmt:TextFormat = txt.getTextFormat (index, index + 1);
 if (fmt.url) url = fmt.url;
 }
 if (url) {
 // begin tooltip code
 }

 ktu



 On Tue, Jun 15, 2010 at 8:49 AM, Glen Pike g...@engineeredarts.co.ukwrote:

 Why not use the mouse coordinates?


 On 15/06/2010 13:24, 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
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders





 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] HTML TextFields - 'A HREF' RollOvers..

2010-06-15 Thread Karim Beyrouti
Got it - that's the one - thanks for the great solution

- karim

On 15 Jun 2010, at 14:07, Ktu wrote:

 sorry, I tacked on that last if statement. It should probably read
 
 if (url.length  0) {
// begin tooltip code
 }
 
 maybe you want to check if its an appropriate web url with a regExp first,
 but I think you get the idea.
 
 Ktu
 
 On Tue, Jun 15, 2010 at 9:05 AM, Ktu ktu_fl...@cataclysmicrewind.comwrote:
 
 
 This in a mouseMove or enterFrame event is what I've always used.
 
 
 var index = txt.getCharIndexAtPoint (txt.mouseX, txt.mouseY);
 var url = ;
 if (index = 0) {
var fmt:TextFormat = txt.getTextFormat (index, index + 1);
if (fmt.url) url = fmt.url;
 }
 if (url) {
// begin tooltip code
 }
 
 ktu
 
 
 
 On Tue, Jun 15, 2010 at 8:49 AM, Glen Pike g...@engineeredarts.co.ukwrote:
 
 Why not use the mouse coordinates?
 
 
 On 15/06/2010 13:24, 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
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 
 
 
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] HTML TextFields - 'A HREF' RollOvers..

2010-06-15 Thread Ktu
Regardless of whether you are using multiple TextFormat objects or htmlText,
using getTextFormat(begin, end), the textFormat will have the appropriate
url.
This is a quick dirty test. Glad I could help out. I'm posting the code for
my test in case anyone else finds it useful.

One thing to note!
If text in a textfield does not fill the text field, a error can appear. In
my code below you can see that error. A link on the bottom line will
register when the cursor is in empty space below the link, but not directly
over it. The x property of the mouse is triggering the rollover. Maybe
someone else can explain this issue better.


AS3 - Timeline code

var txt:TextField = new TextField ();
txt.width = txt.height = 150;
txt.multiline = true;
txt.wordWrap = true;
txt.htmlText = when registered, all a href=\www.google.com\links/a in
text fields will update a href=\www.theflashblog.com\the status bar./a
hahahahah
txt.border = true;
txt.x = txt.y = 100;
addChild(txt);

addEventListener (Event.ENTER_FRAME, captureEnterFrame)

function captureEnterFrame (e:Event):void {
var index = txt.getCharIndexAtPoint (txt.mouseX, txt.mouseY);
var url = ;
if (index = 0) {
var fmt:TextFormat = txt.getTextFormat (index, index + 1);
if (fmt.url) url = fmt.url;
}
if (url) {
displayTooltip(url, new Point (mouseX, mouseY));
} else {
removeTooltip();
}
}

function displayTooltip(url:String, pos:Point):void {
if (getChildByName(ToolTip)) return;
var tf:TextField = new TextField ();
tf.name = ToolTip;
tf.autoSize = left;
tf.text = url;
tf.background = true; tf.border = true;
tf.backgroundColor = 0x00FF;
tf.x = pos.x + 5;
tf.y = pos.y + 15;
addChild(tf);

}
function removeTooltip ():void {
var t:TextField = getChildByName(ToolTip) as TextField;
if (t) removeChild(t);
}

On Tue, Jun 15, 2010 at 9:06 AM, Karim Beyrouti ka...@kurst.co.uk wrote:

 The HREF link is only part the the textfields content, and each textfield
 can have more than one link amongst other copy
 and need to show relevant tooltip only when user is hovering over the 'a
 HREF' parts of the html textfield.

 On 15 Jun 2010, at 13:49, Glen Pike wrote:

  Why not use the mouse coordinates?
 
  On 15/06/2010 13:24, 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
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 
 
 
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] HTML TextFields - 'A HREF' RollOvers..

2010-06-15 Thread Karim Beyrouti
I've added a boolean - to save a few function calls - and also using a Timer ( 
instead of an enterframe) on a slowish delay - to save a few processor cycles.

private var tooltipFlag : Boolean = false;
/**
* @method 
* @tooltip
* @param
* @return
*/
private function detectMouseOverLink( e : TimerEvent = null ) : void {

var index   : Number = label.getCharIndexAtPoint (label.mouseX, 
label.mouseY);
var url : String = ;

if (index  0) {

   var fmt:TextFormat = label.getTextFormat (index, index + 1);
   if (fmt.url) url = fmt.url;
   
}

if ( ( url.length  0 ) 
 ( ! tooltipFlag ) ) {

tooltipFlag = true;
trace('show - url: ' + url + ' tooltipFlag: ' + tooltipFlag );

} else if ( url.length == 0  tooltipFlag ) { 

tooltipFlag = false; 
trace('hide - url: ' + url + ' tooltipFlag: ' + tooltipFlag );

}

}

If i get time - i might turn this into a utility class - so you can do 
something like:

txtRollOverManger.addRollOverListener( txt , callback ) - 
or
txtRollOverManger.removeRollOverListener( txt , callback ) 

i have a few textfields - quite a few timers might affect performance...

thanks...

- karim


On 15 Jun 2010, at 14:33, Ktu wrote:

 Regardless of whether you are using multiple TextFormat objects or htmlText,
 using getTextFormat(begin, end), the textFormat will have the appropriate
 url.
 This is a quick dirty test. Glad I could help out. I'm posting the code for
 my test in case anyone else finds it useful.
 
 One thing to note!
 If text in a textfield does not fill the text field, a error can appear. In
 my code below you can see that error. A link on the bottom line will
 register when the cursor is in empty space below the link, but not directly
 over it. The x property of the mouse is triggering the rollover. Maybe
 someone else can explain this issue better.
 
 
 AS3 - Timeline code
 
 var txt:TextField = new TextField ();
 txt.width = txt.height = 150;
 txt.multiline = true;
 txt.wordWrap = true;
 txt.htmlText = when registered, all a href=\www.google.com\links/a in
 text fields will update a href=\www.theflashblog.com\the status bar./a
 hahahahah
 txt.border = true;
 txt.x = txt.y = 100;
 addChild(txt);
 
 addEventListener (Event.ENTER_FRAME, captureEnterFrame)
 
 function captureEnterFrame (e:Event):void {
var index = txt.getCharIndexAtPoint (txt.mouseX, txt.mouseY);
var url = ;
if (index = 0) {
var fmt:TextFormat = txt.getTextFormat (index, index + 1);
if (fmt.url) url = fmt.url;
}
if (url) {
displayTooltip(url, new Point (mouseX, mouseY));
} else {
removeTooltip();
}
 }
 
 function displayTooltip(url:String, pos:Point):void {
if (getChildByName(ToolTip)) return;
var tf:TextField = new TextField ();
tf.name = ToolTip;
tf.autoSize = left;
tf.text = url;
tf.background = true; tf.border = true;
tf.backgroundColor = 0x00FF;
tf.x = pos.x + 5;
tf.y = pos.y + 15;
addChild(tf);
 
 }
 function removeTooltip ():void {
var t:TextField = getChildByName(ToolTip) as TextField;
if (t) removeChild(t);
 }
 
 On Tue, Jun 15, 2010 at 9:06 AM, Karim Beyrouti ka...@kurst.co.uk wrote:
 
 The HREF link is only part the the textfields content, and each textfield
 can have more than one link amongst other copy
 and need to show relevant tooltip only when user is hovering over the 'a
 HREF' parts of the html textfield.
 
 On 15 Jun 2010, at 13:49, Glen Pike wrote:
 
 Why not use the mouse coordinates?
 
 On 15/06/2010 13:24, 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
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 
 
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com

Re: [Flashcoders] HTML TextFields - 'A HREF' RollOvers..

2010-06-15 Thread Kevin Newman

a:hover works in a css style sheet:

var ss:StyleSheet = new StyleSheet();
ss.parseCSS(a:link{color: #FF;}a:hover{text-decoration: 
underline;color: #FF;});

var tf:TextField = new TextField();
tf.autoSize = TextFieldAutoSize.LEFT;
tf.styleSheet = ss;
tf.htmlText = 'pA 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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
   


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] HTML TextFields - 'A HREF' RollOvers..

2010-06-15 Thread Henrik Andersson
The flash.text.engine package supports mirror regions. I think that 
would be appropiate for this.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] HTML TextFields - 'A HREF' RollOvers..

2010-06-15 Thread Karim Beyrouti
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 capta...@unfocus.com wrote:


a:hover works in a css style sheet:

var ss:StyleSheet = new StyleSheet();
ss.parseCSS(a:link{color: #FF;}a:hover{text-decoration:  
underline;color: #FF;});

var tf:TextField = new TextField();
tf.autoSize = TextFieldAutoSize.LEFT;
tf.styleSheet = ss;
tf.htmlText = 'pA 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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] HTML TextFields - 'A HREF' RollOvers..

2010-06-15 Thread Ktu
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 ka...@kurst.co.uk 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 capta...@unfocus.com wrote:

  a:hover works in a css style sheet:

 var ss:StyleSheet = new StyleSheet();
 ss.parseCSS(a:link{color: #FF;}a:hover{text-decoration:
 underline;color: #FF;});
 var tf:TextField = new TextField();
 tf.autoSize = TextFieldAutoSize.LEFT;
 tf.styleSheet = ss;
 tf.htmlText = 'pA 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
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] HTML TextFields - 'A HREF' RollOvers..

2010-06-15 Thread Karim Beyrouti
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 ka...@kurst.co.uk 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 capta...@unfocus.com wrote:
 
 a:hover works in a css style sheet:
 
 var ss:StyleSheet = new StyleSheet();
 ss.parseCSS(a:link{color: #FF;}a:hover{text-decoration:
 underline;color: #FF;});
 var tf:TextField = new TextField();
 tf.autoSize = TextFieldAutoSize.LEFT;
 tf.styleSheet = ss;
 tf.htmlText = 'pA 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
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] HTML TextFields - 'A HREF' RollOvers..

2010-06-15 Thread Karim Beyrouti

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 ka...@kurst.co.uk 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 capta...@unfocus.com wrote:
 
 a:hover works in a css style sheet:
 
 var ss:StyleSheet = new StyleSheet();
 ss.parseCSS(a:link{color: #FF;}a:hover{text-decoration:
 underline;color: #FF;});
 var tf:TextField = new TextField();
 tf.autoSize = TextFieldAutoSize.LEFT;
 tf.styleSheet = ss;
 tf.htmlText = 'pA 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
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders