swftools-common
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Swftools-common] Re: tip for embedding fonts and modifying text with ac


From: Sairam Suresh
Subject: [Swftools-common] Re: tip for embedding fonts and modifying text with actionscript
Date: Thu, 27 Sep 2007 04:11:38 -0700

Follow-up tip: Someone asked in a previous message about the advanced antialiasing provided in flash 8. Once you've done the steps below to create a text field in actionscript, you can do this:

      text_2.antiAliasType = AntiAliasType.ADVANCED;



On 9/26/07, Sairam Suresh <address@hidden> wrote:
For those bashing their heads against dynamically adding/modifying text blocks in actionscript with fonts embedded by swfc, here's a snippet of code that might help you out:
.flash bbox=420x240
   .font helvetica-light "helvetica-light.swf"

  
   .sprite layer1
    .action:
      this.createTextField("text_1",1,37,41,240,44);
      text_1.multiline = false;
      text_1.wordWrap = false;
      text_1.border = false;

      format_1 = new TextFormat();
      format_1.align="left";
      format_1.font="helvetica-light";
      format_1.size=22;
      format_1.color = 0xFFFFFF;
 
      text_1.embedFonts = true;
      text_1.text = _root.text1;
      text_1.setTextFormat(format_1);
    .end
   .end
  
   .put layer1

.end

The resulting .swf can be called with the urlencoded parameter text1 like so:

http://mydomain.com/test.swf?text1=blah+blah+blah

Of course, this seems like the long way around when swfc provides most of that functionality for you, but when I was writing a function in actionscript that needed a particular embedded font, without the text_1.embedFonts=true; line I was always unsuccessful.

Hopefully this will save you some time if you're in the same boat.



--
Sairam Suresh
FlipClips.com
              . . .  turn your digital videos into flipbooks!
reply via email to

[Prev in Thread] Current Thread [Next in Thread]