Actionscript: TextFormat vs StyleSheet

For handling formatting of TextFields in Actionscript, your two easy options are TextFormat and StyleSheets. And they are mostly equivalent in the level of formatting control that they offer:

TextFormat StyleSheet Note
blockIndent - value to indent entire block instead of only first line
- display Supported values are inline, block, none
bold fontWeight TF: true|false; SS: normal:bold
bullet - TF: part of bulleted list
color color TF: AS notation (0xFFFFFF); SS: HTML (#FFFFFF)
font fontFamily TF: 1 font; SS: uses comma separated list of fonts
indent textIndent  
italic fontStyle TF: true|false; SS: normal|italic
kerning kerning  
leading leading  
leftMargin marginLeft  
letterSpacing letterSpacing  
rightMargin marginRight  
size fontSize  
tabStops - Size of tab
target - target of link if url != null
underline textDecoration TF: true|false; SS: none|underline
url - Setting to non-null value makes text a clickable link

(Created from Adobe docs on StyleSheets and TextFormat)

The use of the two types of flash text formatting options are very similar as well:


Thoughts on Embedding Fonts In Web Pages & Navigational Menus

I'm working on a little web interface for a friend that involves the use of a specific font for the navigation menu items. So far, I've have been a good little developer and have kept everything neat and tidy. The html contains just html with imported style sheets and I have eschewed using javascript by positioning everything with CSS. I can get away with it as a conscious decision was made to ignore IE6 and conform to standards (at least insomuch as the standards are implemented in IE7+, FF3+, and Chrome (assuming that means all webkit browsers & I'll test to make sure that it looks OK in AIR applications too) ).

But fonts are a pain. The friend is a designer, the font WILL be used. That leaves embedding graphics, sIFR, prepackaged Flash or custom Flash. Custom Flash is last because that is what I used, but I will dispatch with the other options as quickly as I can. (There is the @font-face; MS has an IE only font embedding scheme, *.eot files, and FF3.5 will support embedding TTFs but neither is presently practical for wide use.)


Site Navigation Menus, Pure Actionscript & FlashDevelop

A recent requirement at work had me having to forgo Flex for a Flash project. I'm replacing a DHTML site navigation system that employs several images, javascript libraries and, more importantly, places over 70 links onto any given page of the site. I've inherited the job of cleaning up the site SEO-wise and all of these links prevent me from cleanly sculpting the site. At the same time, I am working on improving the performance of the site, and, soon, improving the functionality of the navigation.

Anyway, while I like Flex - really, I like Flex, we need to get a room or something - she can be too heavy for some tasks, and the thought of dropping over 100KB of Flashy goodness on everything single page of the site is less than desirable. Instead, at my current level, I am more than halfway there just using a pure Actionscript Flash project and I have kept my SWF size down to under 4KB. Keep in mind, I am using an XML supporting doc that adds 7KB or so, but I would use the same file for Flex or Flash.


BlogCFC was created by Raymond Camden. This blog is running version Contact Blog Owner