Thank you very much Peter, that did it!

On 1/15/07, Peter Watson <[EMAIL PROTECTED]> wrote:

   Rick,



Try calling the setStyle() in the updateDisplayList() function rather than
creationComplete.



creationComplete will only get called once – but the cell is rendered
multiple times when you scroll so you'll end up with intermittent results
like you are seeing.


http://livedocs.macromedia.com/flex/2/docs/00000850.html#233552



updateDisplayList() ensures that anytime the display changes, your code
will get run and render with the correct font.



<mx:Script>

                        <![CDATA[

                                    override protected function
updateDisplayList( uw:Number, uh:Number ):void{

                                                super.updateDisplayList(
uw, uh );

                                                trace(data.label);

                                                setStyle("fontFamily",
data.font);

                                                text=data.label;

                                    }

                        ]]>

</mx:Script>





regards,

peter


 ------------------------------

*From:* [email protected] [mailto:[EMAIL PROTECTED] *On
Behalf Of *Rick Schmitty
*Sent:* Monday, January 15, 2007 12:40 PM
*To:* [email protected]
*Subject:* [flexcoders] Re: Combobox Display issues



bump

On 1/11/07, Rick Schmitty <[EMAIL PROTECTED] <flexcode%40gmail.com>>
wrote:
> Hi all, I'm having some wierd display issues when using a font in a
> combo box. Things dont pop up where they should or appear in doubles
> (aside from the intentional repeating)
>
> Here is the snippet
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>
> <mx:Script>
> <![CDATA[
> [Bindable]
> private var dp:Array=[{label:"0 Arial",font:"myArial"},
> {label:"1 Rage",font:"myRage"},
> {label:"2 Bookman Antica",font:"myBkant"},
> {label:"3 Tahoma",font:"myTahoma"},
> {label:"4 Times New Roman",font:"myTimes"},
> {label:"5 Trebuchet",font:"myTrebuc"},
> {label:"6 Arial",font:"myArial"},
> {label:"7 Rage",font:"myRage"},
> {label:"8 Bookman Antica",font:"myBkant"},
> {label:"9 Tahoma",font:"myTahoma"},
> {label:"10 Times New Roman",font:"myTimes"},
> {label:"11 Trebuchet",font:"myTrebuc"},
> ];
> ]]>
> </mx:Script>
>
> <mx:DataGrid id="dg" dataProvider="{dp}"/>
>
> <mx:ComboBox id="cb" dataProvider="{dp}">
> <mx:itemRenderer>
> <mx:Component>
> <mx:Text xmlns:mx="http://www.adobe.com/2006/mxml"; fontSize="14"
> creationComplete="init()">
> <mx:Script>
> <![CDATA[
> private function init():void {
> trace(data.label);
> setStyle("fontFamily",data.font);
> text=data.label;
> }
> ]]>
> </mx:Script>
> </mx:Text>
> </mx:Component>
> </mx:itemRenderer>
> </mx:ComboBox>
>
>
>
> <mx:Style>
> @font-face {
> src: url("/assets/fonts/ARIAL.TTF");
> fontFamily: myArial;
> }
> @font-face {
> src: url("/assets/fonts/BKANT.TTF");
> fontFamily: myBkant;
> }
> @font-face {
> src: url("/assets/fonts/TAHOMA.TTF");
> fontFamily: myTahoma;
> }
> @font-face {
> src: url("/assets/fonts/TIMES.TTF");
> fontFamily: myTimes;
> }
> @font-face {
> src: url("/assets/fonts/TREBUC.TTF");
> fontFamily: myTrebuc;
> }
> </mx:Style>
> </mx:Application>
>

Reply via email to