PDA

View Full Version : How to change the label color of Radio button


rajeshambady
03-14-2007, 06:42 AM
Hi,


I am using a radio button component. How can I change the color of the label text...

inhan
03-14-2007, 06:59 AM
rb.setStyle("color", 0x25D19D);

rajeshambady
03-14-2007, 07:03 AM
Thank you very much...

rajeshambady
03-14-2007, 07:13 AM
I want to check wether the radio button is selected or not.. I tried with this

if(radioGroup.selected = false){
trace("the button selected");
}

but it is not working ....

inhan
03-14-2007, 07:37 AM
You need an eventListener for that:var rbListener:Object = new Object();
rbListener.click = function(evt_obj:Object) {
trace("rb selected");
};
rb.addEventListener("click", rbListener);

inhan
03-14-2007, 07:41 AM
Or while you have more than one radio buttons:
var rbListener:Object = new Object();
rbListener.click = function(evt_obj:Object) {
trace("The selected radio instance is " + radioGroup.selection);
};
radioGroup.addEventListener("click", rbListener);
radioGroup.setStyle("color", 0x25D19D);

rajeshambady
03-14-2007, 08:15 AM
You are a genuis

I have one more problem.. my radio buttons (group) is inside a movie clip with instance name res_zoom_09.

I have a button inside the same movieclip with instance name submit.



_root.res_zoom_09.submit.onRelease = function(){

var rbListener:Object = new Object();
rbListener.click = function(evt_obj:Object) {
trace("The selected radio instance is " + _root.res_zoom_09.radioGroup.selection);
};
_root.res_zoom_09.radioGroup.addEventListener("click", rbListener);
}


This code is not working... when I pasted it inside the movie where the radio button lies the code is working.

inhan
03-14-2007, 08:54 AM
Something like this, maybe?

res_zoom_09.selectedBtn = null;
var rbListener:Object = new Object();
rbListener.click = function(evt_obj:Object) {
res_zoom_09.selectedBtn = res_zoom_09.radioGroup.selection;
};
res_zoom_09.radioGroup.addEventListener("click", rbListener);
res_zoom_09.submit.onRelease = function() {
trace(this._parent.selectedBtn);
};