Creating a multi-column HTML-Text Component, I have discovered a strange behavior in the TextField Class:
What I need is several Textfields that are not selectable. Now when I set myTextField.selectable = false, the TextField no longer captures TextEvent.LINK-event. That seems to be a known bug (see msg #36058 ).
Now the mystery:
When I add an MouseEvent.CLICK-eventListener to the TextField I seem to get around this bug and the TextEvent.LINK-event gets fired. But only when I display an Alert-box in the Click-event..
Example:
packageIf I place this component on the Stage and run the Application, I have to click once (anywhere) on the TextField to fire the CLICK-event and show the Alert box in order to enable the LINK-event.. Can anyone explain that to me? Or does anybody know another way to enable the LINK-event on non-selectable TextFields?
{
import flash.text.TextField;
import flash.events.MouseEvent;
import flash.events.TextEvent;
import mx.controls.Alert;
import mx.core.UIComponent;
public class MyTextField extends UIComponent
{
private var _textField:TextField;
override protected function createChildren():void {
super.createChildren();
_textField = new TextField();
with (_textField) {
htmlText = "<a href="" 1\">link 1</a> <a href="" 2\">link 2</a> no link";
selectable = false;
mouseWheelEnabled = false;
addEventListener(MouseEvent.CLICK, textClickListener);
addEventListener(TextEvent.LINK, linkClickListener);
}
addChild(_textField);
}
private function textClickListener(e:MouseEvent):void {
// I need to show this Alert box here to enable the TextEvent.LINK event
Alert.show("Text clicked");
}
private function linkClickListener(e:TextEvent):void {
Alert.show("Link clicked: "+e.text);
}
}
}
Thanks in advance and all the best,
Bastian
__._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
| Web site design development | Computer software development | Software design and development |
| Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
__,_._,___

