Although I have had my fair share of headaches with TextFormat, I
think I may know what is going on here.

There are two methods for assigning a textFormat to a textField. These
are setTextFormat() and setNewTextFormat().

The way I understand it setTextFormat() sets the style of the text
that is currently assigned to the textField BUT any new text assigned
by actionscript, by replaceSel() or by the user (in the case of input
text) is styled according to the setNewTextFormat() method and if none
is given, as in your class, the new text is given some default style,
which, as you've noticed, is not necessarily the same as the style you
defined by setTextFormat().

so I would try using setNewTextFormat() also and see if that works.

J

On 3/10/06, Merrill, Jason <[EMAIL PROTECTED]> wrote:
> I finally did get this to work by trying it in a fresh .fla, but now I'm
> seeing this issue:
>
> When I do this:
>
> import com.icfconsulting.objects.SimpleTextField;
> tf=SimpleTextField.create(this)
>
> It's fine, the text field show and with the right font.  But when I try
> and set the text on the text field it returns, like this:
>
> import com.icfconsulting.objects.SimpleTextField;
> tf=SimpleTextField.create(this)
> tf.text="hello, hello!"
>
> It just shows blank, like setting the text on the text field my class
> returns screws it up somehow.  Any idea what's up? The class code is the
> same, and I am trying this in a new fresh .fla with a "Swis" font in the
> library.  Why would adding that one line screw it up again?
>
> My simple class test file is as follows:
>
> class com.icfconsulting.objects.SimpleTextField{
>        public static function create(target_mc:MovieClip):TextField{
>                var my_fmt:TextFormat = new TextFormat();
>                my_fmt.font = "Swis";
>                my_fmt.color = 0x000000;
>                my_fmt.size = 16;
>                target_mc.createTextField("tf_txt",0,20,20,200,20);
>                target_mc.tf_txt.embedFonts = true;
>                target_mc.tf_txt.text="Hello world";
>                target_mc.tf_txt.setTextFormat(my_fmt);
>                return target_mc.tf_txt;
>        }
> }
>
> Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com
>
>
>
>
> NOTICE:
> This message is for the designated recipient only and may contain privileged 
> or confidential information. If you have received it in error, please notify 
> the sender immediately and delete the original. Any other use of this e-mail 
> by you is prohibited.
> _______________________________________________
> 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