actionscript 3: border for label of progressbar not working - actionscript-3

Is there anyone know how to make border for label of progress bar in action script 3? I tried to setStyle("borderColor",#ff0000) but it's not success.

In the example code of the Documentation I see that styles are initialized with the notation 0xAAB3B3.
I would suggest to change the color in your function to 0xff0000.
The 0x means that it's a Hexadecimal number.

You can change the border color of the label of a mx.controls.ProgressBar component using mx.core.mx_internal like this :
progress_bar.mx_internal::_labelField.border = true;
progress_bar.mx_internal::_labelField.borderColor = 0x0000ff;
Hope that can help.

Related

Change font color of TextButton on click?

I've read some tutorials and documentation on scene2d's UI capabilities, but I can't quite figure out how the skins work. I simply want a TextButton that changes color when pressed. I managed to get the background of the TextButton to change, but that's not what I wanted. It should have no background.
I would be very grateful if anyone could provide an example of how this could be done. It seems very simple, so I think I'm missing something obvious here. If a skin is involved, please write it programmatically.
Thank you.
Turns out it was as simple as I thought, it just didn't work when I tried it the first time.
When defining the TextButtonStyle you can assign downFontColor the color you want your text to be while it is being pressed. You can also assign checkedFontColor the color you want the text toggle between when pressed.
Example:
TextButtonStyle textButtonStyle = new TextButtonStyle();
textButtonStyle.font = someBitmapFont;
textButtonStyle.fontColor = Color.WHITE;
textButtonStyle.downFontColor = Color.BLACK;
//Optional color to toggle between when pressed
textButtonStyle.checkedFontColor = Color.GREEN;
final TextButton textButton = new TextButton("Text", textButtonStyle);
This will produce a white TextButton that turns black when it is pressed. When the mouse/touch is released it'll either turn green or white, depending on the state of the toggle.
You can also tint it, but the effect depends on the base color (if it is white, then it works perfectly, else it depends). Anyway, it's done like this:
button.getLabel().setColor(myColor);

change button color action script 3

btnPlanet.mouseEnabled = false;
btnPlanet.mouseChildren = false;
i have button and it's called btnPlanet, i want to change button color when they are disabled, but the button contain text, that if i change button color using colorTransform, it make my text dismissed, and filled with color that i use from colorTransform, can i change only color of shape in button without change text color? or make it grayscale at least? thank you, i'm sorry if i have bad grammar english
Apply alpha/colorTransform/whatever to everything EXCEPT text field.
Is it your own button or you're using some kind of component?
If it's your own I bet you have something like background for shape and TextField on top of that.
If it's a component I'm pretty sure you should be able to access it as well.
that's not hard.set instance name of your shape in your button for example myShape. Then write:
btnPlanet.myShape.transform.colorTransform=new ColorTransform(your colortransform settings)

flex - how to set the background color of a spark check box text label?

I have a simple spark mxml check box and I want to change the background color via actionscript. I have searched and tried many suggestions, including using setStyle with 'background-color', 'chromeColor', symbolColor and others like this - the only thing that worked at all is chromeColor, which colored the box but not the text or background:
insUpdatedCB.setStyle('chromeColor','yellow');
I also tried using text format like this:
var myTf:TextFormat = new TextFormat();
myTf.size = 16;
myTf.color = 0xFF0000;
insUpdatedCB.setStyle("textFormat", myTf);
also did not work
how can I set the label/text background color?
If you want to change the background color of the spark checkbox, then you have to apply a custom skin for it. Make a new Custom skin by making a copy of default checkboxSkin for spark checkbox, and then change the background color of the label in the Custom Skin.

How can you change a Label's color at runtime in ActionScript 3.0?

I get the following error:
1119: Access of possibly undefined property color through a reference with static
type mx.controls:Label.
The thing about that is that, in the MXML, color is an attribute of Label. But if I try to say something like:
lblUpgrade.color = "#000000";
it throws this error. I've been trying to find a work-around for the last 45 minutes. How can I set this at runtime? Thanks!
Label does not have a color property, rather it has a color style which can be set like so:
lblUpgrade.setStyle("color","#000000");
Styles are accessed like this in as3
lblUpgrade.setStyle("color","#000000");
color is a style not a property, you set it using setStyle. Also with as3 you use 0x instead of # for the color, but maybe that works for styles.
lblUpgrade.setStyle("color", "0x000000");
Wow, I've been struggling for 45 minutes AFTER I found this post. I'm using Adobe CS6 (don't ask why!) and the only way that finally works for me is this:
/* Create a new TextFormat object,
which allows you to set multiple text properties at a time. */
var tf:TextFormat = new TextFormat();
tf.color = 0xFF0000;
/* Apply this specific text format (red text) to the Label instance. */
a_label.setStyle("textFormat", tf);
Hope this helps someone. Source: Adobe Help Center
You can also use TextFormat to change other properties like Font, Size etc.

setting actionscript textarea color to black

I have some simple actionscript 3 code which compiles and runs without error but doesn't do anything. I just want to change the bacground color to black (or transparent). How can this be done?
myTextArea.setStyle("backgroundColor", "0x000000");
I've tried the color argument without quotes and as "black" but nothing seemes to work.
I can't test it right now, but it should be enough to change your code to:
myTextArea.textField.opaqueBackground = 0x000000;
See this link on SO, if you need more help:
How do I change the colours of a textarea in actionscript?