Can we setSelection in flex UITextField without focus - apache-flex

I want to set background color for specified range of text in UITextField. So Itried using setSelection. But it need focus. Any one please help. Can we set selection without focus.

Use UITextField.alwaysShowSelection property.

Related

Datagrid cell color

I want to change cell color while user interaction without using itemrenderer. I am able to change fontcolor, fontsize, fontfamily except the cell background color. Is there any way to do this without using itemrenderer?
Thanks in advance
No, there is none. The ItemRenderer defines how the cell looks.

Flex DropDownList Normal state border color

So I'm trying to change to appearance of a spark DropDownList when it's in the normal state. I thought I color used the borderColor property but that seems to only change the color of the border when the list is open. Any ideas? Thanks In advance.
You're right about borderColor in case of using standard spark.skins.spark.DropDownListSkin. But you can create your custom implementation of spark.skins.spark.DropDownListButtonSkin which displays button part of DropDownList and then create your own DropDownListSkin which will use your button with desired border. All the skins can be exact copies of original skins with minimum required customization.

Change color of a Flex 4 spark Button

Is there an easy way to change the background color of a Flex 4 spark Button without messing with skins?
UPDATE: ok, figured it out, simply set the chromeColor attribute of the Button mxml.
For spark components, you can use chromeColor style:
<s:Button chromeColor="0xff0000" label="chrome red"/>
You can change the color style of the button. You can also have a bitmap fill.
Update: The above methods do not change the background.
Easiest way to change the background, you can use - opaqueBackground property.
Here is another way to change the background of a button without changing its skin -
1. Create a group with a rectangle and your button.
2. Set opaqueBackground of your button to null.
3. Make width and height of rectangle to 100%
4. whatever color you fill the rectangle with is the background of your button.
This can also be done via code like :-
btnID.addEventListener(MouseEvent.MOUSE_OVER, textChange);
btnID.addEventListener(MouseEvent.MOUSE_OUT, textChangeback);
private function textChange(event:MouseEvent):void
{
btnLinkDelete.setStyle("color", 0xFFFFFF)
btnLinkDelete.setStyle("chromeColor", 0x535151)
}
private function textChangeback(event:MouseEvent):void
{
btnLinkDelete.setStyle("color", 0x000000)
btnLinkDelete.setStyle("chromeColor", 0xfcffff)
}
I am posting it, if anyone want to change background color on mouse hover.

Flex text selection: does it have to be white on black?

When you select text in a Text or Label or TextArea (or other) control in a Flex application, the selection is shown in white text on a black background. Always.
I have a request to change that — and it seems to be a simple enough thing to want — but I can't find a style (or property) anywhere that permits that. Any ideas out there about how to do this, or reasons why it definitively can't be done?
Change TextField selection color in AS3
http://ericlin2.tripod.com/select/selectt.html

Change size of checkbox in Flex

In Flex, is there an easy way to change the size of a Checkbox? I want to make the checkbox bigger, but the label beside it the same font size. Thanks!
I've used scaleX and scaleY. I think the syntax is scaleX="1.5" scaleY="1.5" to make it 50% larger.
I would imagine you could programatically skin the checkbox but ive never done it. Just increase the w and h passed in from the updateDisplayList(w:Number, h:Number) function when creating a programmatic skin.
Another option, albiet rather hacky, would be to make a custom control. A canvas, a label for the checkbox text and an image for the actual "check". Click on the image, if its checked it shows your unchecked image and vice versa.

Resources