Ah. Try setting the textformat AFTER you set the text.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Michael Trim
Sent: Tuesday, July 17, 2007 10:47 AM
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] Font in Library problems

That's a mistake, I've tried a lot of variations to get this working!

I can't find an example online where this works inside a class, all the
documentation has timeline examples (which I can get working with same
font).


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David
Ngo
Sent: 17 July 2007 15:29
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] Font in Library problems

Not sure where your error is, but can I ask why you're instantiating
your
Font instance twice?


David


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Michael
Trim
Sent: Tuesday, July 17, 2007 10:12 AM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Font in Library problems

Can anyone tell me why the following isn't displaying any text?

No Compiler errors, all traces show objects existing?

If I remove the textformat all together it appears on stage in times.


______________________________________________________________


package com.instantbusiness.client.project.display.map{
        
        import flash.display.Sprite;
        
    import flash.text.*;
        import flash.events.MouseEvent;
        import ClientRegular;
        

        
        
        public class Label extends Sprite{
                
                private var labelText:TextField;
                private var labelFormat:TextFormat;
                private var clientRegular:Font = new ClientRegular();   
                
                
                public function Label(){        
                        
                        trace("Label: " + this + " \n");
                        
                        
                        clientRegular = new ClientRegular();
                        
                        trace("clientRegular: "+clientRegular);
                        
                }               
                
                
                public function setText(labelStr:String){
                        
                        labelFormat      = new TextFormat();
                        labelFormat.color = 0xFF0000;
                        labelFormat.size = 20;
                        labelFormat.font = clientRegular.fontName;
                        
                        trace("clientRegular.fontName
"+clientRegular.fontName);
                        
                        trace(labelFormat);

                        labelText = new TextField();

                        labelText.embedFonts = true;
                        labelText.autoSize = TextFieldAutoSize.LEFT;
                        labelText.antiAliasType =
AntiAliasType.ADVANCED;

                        labelText.selectable = false;
                        labelText.mouseEnabled = true;
                        labelText.setTextFormat(labelFormat);
                        trace(labelText);
                        trace(labelText.getTextFormat());
                        labelText.text = labelStr;
                        addChild(labelText);
                        
                }
                
                
        }
        
}

__________________________________________________________

Thanks, Michael.
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to