View Full Version : Skinning the ComboBox
Flash Gordon
11-01-2007, 03:08 AM
How do I skin the combo box to make it look like the graphic in the FLA? I've got the the basic graphics, but I can't seem to change the fonts size, color, spacing, etc.
LINK TO SOURCES (http://www.modernmusicians.com/help/skin drop down.zip)
Thanks for the help.
:)
Flash Gordon
11-02-2007, 06:25 PM
Basically all I need to do is move the prompt text up to have it displaying correctly. Anybody know how to do this?
atomic
11-02-2007, 06:37 PM
http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00003167.html
Flash Gordon
11-02-2007, 09:04 PM
Thanks atom, that is basically what I'm doing, but I'm not sure why most of it isn't working. Here is what I currently have:
var tf:TextFormat = new TextFormat("Helvetica", 10, 0x7FA9C6);
//drop_cb.textField.textField.defaultTextFormat = tf; // doesn't work
//drop_cb.textField.textField.setTextFormat(tf); // doesn't work
drop_cb.addItem( {label:"Option1", data:"Option 1 data"} );
drop_cb.addItem( {label:"Option2", data:"Option 2 data"} );
drop_cb.addItem( {label:"Option3", data:"Option 3 data"} );
//drop_cb.setStyle("textFormat", tf); // doesn't work
drop_cb.textField.setStyle("textFormat", tf);
drop_cb.dropdown.setStyle("textFormat", tf); // does work
drop_cb.textField.y -= 15; // doesnt't move the prompt up but traces correctly.
I'm trying to move the prompt/current selection textfield up. And change the fonts/color of the list component. However, I can't get either of those to work.
atomic
11-02-2007, 09:09 PM
I couldn't open your .fla, because of your CS3 format...
Flash Gordon
11-02-2007, 09:11 PM
I'd change it to F8, but with CS3, there is a really easy way of skinning the components (double click them and change to whatever) so I doesn't work if I save it to F8 though the actionscript is still the same (or close).
But thanks for the help anyway!!!
Flash Gordon
11-03-2007, 05:27 AM
Well this is good enough for me. It's very sloppy but it suits my needs. Please post if you have a better answer.
var tf:TextFormat = new TextFormat("Helvetica", 10, 0x7FA9C6);
drop_cb.textField.setStyle("textFormat", tf);
drop_cb.setStyle("textPadding", -1);
drop_cb.setStyle("embedFonts", true);
drop_cb.textField.textField.autoSize = "center";
drop_cb.prompt = " --select one--";
drop_cb.addItem( {label:"Option1", data:"Option 1 data"} );
drop_cb.addItem( {label:"Option2", data:"Option 2 data"} );
drop_cb.addItem( {label:"Option3", data:"Option 3 data"} );
drop_cb.addItem( {label:"Option4", data:"Option 4 data"} );
drop_cb.addItem( {label:"Option5", data:"Option 5 data"} );
drop_cb.addItem( {label:"Option6", data:"Option 6 data"} );
EDIT: This is much cleaner
var tf:TextFormat = new TextFormat("Helvetica", 10, 0x7FA9C6);
//tf.font = "Akbar";
tf.leftMargin = 8; // <-- control the left padding here rather than with extra space.
drop_cb.textField.setStyle("textFormat", tf);
drop_cb.setStyle("textPadding", -1);
Flash Gordon
11-09-2007, 09:14 PM
actually, the text isn't embedding. Anyone know how to get the text to embed?
dr_zeus
11-09-2007, 09:58 PM
myComboBox.setStyle("embedFonts", true);
Flash Gordon
11-09-2007, 10:09 PM
drop_cb.setStyle("embedFonts", true);
myComboBox.setStyle("embedFonts", true);
not sure I see the difference.
Flash Gordon
11-09-2007, 11:20 PM
Got it:
drop_cb.textField.setStyle("embedFonts", true);
now just got to figure out how to do it for the list in the combo box and figure out how to have 2 completely different skinned ComboBoxes in the same FLA. Fun stuff....
atomic
11-10-2007, 02:04 AM
One's never better served than by one's self!
Flash Gordon
11-10-2007, 06:52 AM
LoL...that could so go down the wrong path ;)
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.