Flash Combobox setStyle works in Test (debug) and not in Publish (swf)
August 25, 2011 February 20, 2020
I tried to customize the combobox ( AS3 ), and everything was working fine by using cbo.setStyle( “embedFonts” ) and cbo.setStyle( “textFormat” ) while testing the movie. However, when I published the SWF, the styles were no longer working.
It seems like setStyle doesn’t really work properly for comboboxes for some reason. The solution was to apply the setStyle to the textField inside the combobox, and not to the combobox itself.
For example, this doesn’t work:
cbo.setStyle( "embedFonts", true ); cbo.setStyle( "textFormat", tf );
but this works:
cbo.textField.setStyle( "embedFonts", true ); cbo.textField.setStyle( "textFormat", tf );