home |  
Sell Downloads - Ejunkie
open db network by 19.5 degrees
LYRICS | FREE E-BOOKS | SELL DOWNLOADS WITH PAYPAL
 in   
contribute for fun & profit
brink
-Array functions..
-Flash Remoting ..
-str_pad functio..
-Detecting mouse..
-Ltrim, Rtrim an..
-Opening externa..
-Modifying Flash..
-Smoothing effec..
-Array functions..
-Drawing / Vecto..
 
See all Flash Tutorials
 
-Extensions/Plug..
-FLA..
-Flash Software..
-Flash Tutorials..
 
See all Flash
 
All Resources > Flash > Flash Tutorials > ACTIONSCRIPT TUTORIALS
spread the word around  send this page to a friend   read/write comments/corrections/additions comments  rate this 

Modifying Flash MX FCheckBox & FRadioButton components to allow using textSelected property

by 19.5 Degrees
 
 
views: 4913 | rating: 4/10
 


If you have ever used FCheckBox and FRadioButton components that come with Flash MX, you must be knowing that you can change the text color using

componentInstanceName.setStyleProperty("textColor", 0xFF0000);

This would just change the color of the text label accompanying your check box or radio button. Now, I wanted to change the color of the text when the checkbox or radio button is selected (ticked), so I thought it will be as simple as

componentInstanceName.setStyleProperty("textSelected", 0x00FF00);

but I think for some reason the "textSelected" styleProperty is only applicable to FComboBox and FListBox components. Well, I didn't give up and realized that adding a single line of code to both, FCheckBox and FRadioButton components will do the trick.

Procedure for FCheckBox:
   
1. Drag the component on to stage.
2. Right click on it, select "Edit in place" from the right click menu options.
3. Do you see the little "a" on the Actions Layer, right click on it select "Actions" from the right click menu options.
4. Find the line

FCheckBoxClass.prototype.setCheckState = function( checkedValue );
5. Few lines below that you'll see

states.gotoAndStop( "checkedEnabled" );
6. Add this just below that line

this.fLabel_mc.setColor(this.fLabel_mc.hostComponent.styleTable.textSelected.value);
7. That's it! Just put this line in the timeline containing your component

componentInstanceName.setStyleProperty("textSelected", 0x00FF00);

(replace 0x00FF00 with your own color)
   
Procedure for FRadioButton:
   
1. Drag the component on to stage.
2. Right click on it, select "Edit in place" from the right click menu options.
3. Do you see the little "a" on the Actions Layer, right click on it select "Actions" from the right click menu options.
4. Find the line

FRadioButtonClass.prototype.setState = function( selected );
5. Few lines below that you'll see

this.frb_states_mc.gotoAndStop("selectedEnabled");
6. Add this just below that line

this.fLabel_mc.setColor(this.fLabel_mc.hostComponent.styleTable.textSelected.value);
7. That's it! Just put this line in the timeline containing your component

componentInstanceName.setStyleProperty("textSelected", 0x00FF00);

(replace 0x00FF00 with your own color)


« PREVIOUS
  INDEX
NEXT »

spread the word around
read comments
no comments posted!

read more commentspost comment 



home | contact | contribute | terms of use | privacy policy |