Skip to content

marceloduende/Utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TextFactory

It's a TextField util that allows to add text in one line of code with a bunch of parameters

var t:TextFactory = new TextFactory();
var tf:TextField = new TextField();
tf = t.addText({text:'This is my text', antiAlias:'advanced', width:500, align:"right", style:"bold", size:50, color:0xFF0000});
addChild(tf);

Params

  • @param text - String(); This is the text to display.
  • @param style - String(); This is the text's style. It can be pre set accordingly how many styles it has.
  • @param align - String(); The alignment of the text. They can be 'left', 'right', 'center' and 'justify'.
  • @param antiAlias - String(); Defines the antiAlias. They can be 'advanced' and 'normal'.
  • @param size - Number(); The size of the text. Twelve is the default.
  • @param letterSpacing - Number(); The space between letters.
  • @param width - Number(); The width of the text box.
  • @param color - uint(); The hexa code for the color.
  • @param backgroundColor - uint(); The hexa code for the backgroundColor.
  • @param selectable - Boolean(); Defines whether the text will be selectable or not.
  • @return TextField().

Customization

  • To add or remove fonts, you should open the fonts.fla on the lib folder, add your favorite font and export to actionscript at the linkage. Done that, export a .swc overwriting the fonts.swc.
  • With the step 1 done, simply open the Fonts.as file and add or remove the fonts you want.
  • The last but not least, at TextFacotry.as change the switch at the line 86 where the font names are defined.

With all that done, you're good to mess around. Have a nice coding.


About

Toolkit responsible to optimize time and code.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published