How to change SelectionColor in TLFTextFielfd created with var txtTest:TLFTextFielfd = new TLFTextFielfd(); syntax ?
I am not sure if that is what you mean. Select a text part and it will change the color when the mouse is up. import fl.text.TLFTextField; import flash.text.TextFieldAutoSize; import flash.text.TextFormat; import flash.events.MouseEvent; var redFmt:TextFormat = new TextFormat(); redFmt.color = 0xFF0000; var tlfText:TLFTextField = new TLFTextField(); tlfText.border = true; tlfText.text = "You change the selectioncolor with textformat."; tlfText.wordWrap = true; tlfText.autoSize = TextFieldAutoSize.LEFT; tlfText.x = 100; tlfText.y = 100; tlfText.addEventListener(MouseEvent.MOUSE_DOWN, downHandler); tlfText.addEventListener(MouseEvent.MOUSE_UP, upHandler); trace(tlfText.selectionBeginIndex); addChild(tlfText); var begIndex:int; var endIndex:int; function downHandler(event:MouseEvent):void { begIndex = event.currentTarget.selectionBeginIndex as int; } function upHandler(event:MouseEvent):void { endIndex = event.currentTarget.selectionEndIndex as int; tlfText.setTextFormat(redFmt, begIndex, endIndex); }
- The right of the People to create Flash movies shall not be infringed. -
When you select a porsion of a TLFextfield using setSelection method there are two color, first is text color and other is selected portion background color. In am talking about that selected background color part of the TLFextfield.
You cannot change the Selectioncolor unless you use workarounds. Here are workarounds for a regular textfield. http://yourpalmark.com/2007/08/13/ch...ic-textfields/ http://labs.hellokeita.com/2007/11/1...ter-the-trick/
Forum Rules