Hi,
I’m looking for a way to set the font and the font color inside a listbox…
I’ve lookes to setStyle, and textformat but it doesn’t seem to work…
Please Help!
Hi,
I’m looking for a way to set the font and the font color inside a listbox…
I’ve lookes to setStyle, and textformat but it doesn’t seem to work…
Please Help!
you were so close too. =P its actually setRendererStyle() and here is an example from the help files:
import fl.controls.List;
var myTextFormat:TextFormat = new TextFormat();
myTextFormat.font = "Comic Sans MS";
var myList:List = new List();
myList.addItem({label:"The quick brown fox..."});
myList.addItem({label:"The quick brown fox..."});
myList.addItem({label:"The quick brown fox..."});
myList.addItem({label:"The quick brown fox..."});
myList.addItem({label:"The quick brown fox..."});
myList.addItem({label:"The quick brown fox..."});
myList.setRendererStyle("textFormat", myTextFormat);
myList.width = 150;
myList.move(10, 10);
addChild(myList);
<P><FONT style=“BACKGROUND-COLOR: #f5f5ff”>here is the code i used, but still doesn’t work:</FONT></P>
<P><FONT style=“BACKGROUND-COLOR: #f5f5ff”></FONT> </P>
<P><FONT style=“BACKGROUND-COLOR: #f5f5ff”>var liste:List = new List();</FONT></P>
<P><FONT style=“BACKGROUND-COLOR: #f5f5ff”>liste.addItem…</FONT></P><FONT style=“BACKGROUND-COLOR: #f5f5ff”>
<P><FONT style=“BACKGROUND-COLOR: #f5f5ff”>liste.setRendererStyle(“textFormat”, “tf”);</FONT></P>
<P>liste.width = 100;</FONT></P>
<P><FONT style=“BACKGROUND-COLOR: #f5f5ff”>liste.move(250,250);</FONT></P>
<P><FONT style=“BACKGROUND-COLOR: #f5f5ff”>addChild(liste);</FONT></P>
<P><FONT style=“BACKGROUND-COLOR: #f5f5ff”></FONT> </P>
<P><FONT style=“BACKGROUND-COLOR: #f5f5ff”></FONT> </P>
<P><FONT style=“BACKGROUND-COLOR: #f5f5ff”>Where do I have it wrong?</FONT></P>
[QUOTE=ventoline;2353069]liste.setRendererStyle(“textFormat”, “tf”);[/QUOTE]
tf should not be a string it should be the TextFormat object, and be sure to make it before setting it to your list
[AS]var myTextFormat:TextFormat = new TextFormat();
myTextFormat.font = “Comic Sans MS”;
myTextFormat.color = 0x0000FF // blue
liste.setRendererStyle(“textFormat”, myTextFormat);[/AS]
Thanx, A Lot.
pffew, finally working. weid the documentation shows it as (“textFormat”, “tf”)!!
Hello, me again!
Now I’m struggling to adjust width and height, and border of cells,
I’ve looked at setstyle, Cellrenderer… it doesn’t seem to work this way…
anyone knows?
you don’t have to do that programmatically. You can double click the item in your library and edit them. (when you double click, you’ll see how they set up the components for you so you can edit them as you wish - it’s really neat!)…I’m assuming you are using cs3
this.list.rowHeight+=3;
:: Copyright KIRUPA 2024 //--