Hi,

The list / combobox & a few other components in AS3 / CS3 use the DataProvider to specify what goes in the boxes...

//Create, then fill up the data provider or pass an array to the constructor...
   var dp:DataProvider = new DataProvider();
//set the combobox's dataprovider.
   myCB.dataProvider = dp

To change the style of the text, you will have to implement a Custom CellRenderer - there is an example on this page: http://www.rockabit.com/2008/04/15/combobox-text-formatting-in-as3/

   This only sets one font up for the whole box, but hold on a minute...

If you want to display a list of fonts on the system, the first few lines of the code in this page will tell you how to get them and then add them to a list / combobox:

http://www.emanueleferonato.com/2008/05/21/create-a-font-browser-with-flash-as3/

So now what you need to do, is see what the data is in each row of your list - you can do this by overriding some of the "getters" and "setters" in your Custom CellRenderer:

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/fl/controls/listClasses/CellRenderer.html#data

   //Something like this:
   override public function set data(value:Object):void {
      var tf:TextFormat = new TextFormat();
      tf.font = value.label;
      textField.setNewTextFormat(tf);
      this._data = data;
   }

CellRenderers are a bit fiddly to get right, but once they are working, they are quite nice - if the code I put here does not work, read up in the doc's because my code may be wrong...

   HTH

   Glen
Digg Yeah wrote:
Hi All,
Is it possible to display custom fonts in the dropdown list of a Flash cs
combobox component?
I am trying to do something as shown at
http://arulprasad.blogspot.com/2006/07/showing-list-of-fonts-in-flash-v2.html
But im getting stuck at
myCB.dropdown.listContent[i].cell.getTextFormat ();


What is the equivalent of  listContent in AS3?

Thanks for your time. Any help would me much appreciated.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



--

Glen Pike
01326 218440
www.glenpike.co.uk <http://www.glenpike.co.uk>

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to