Tuesday, September 4, 2012

NBSP in Flash

Using NBSP (non-breakable space) in flash is non-obvious.
Some method using htmlText exist (use  , which was not supported but now is), but if for some reason you don't want to use HTML, here is a workaround:

  1. use the special character "\u00A0" (UTF-8 code  00A0)  in your actionscript code to put nbsp anywhere you want;
  2. voilà! Test your SWF and check.
  3. if some weird square appears in lieu of the expected nbsp, that probably because you font doesn't implement this UTF-8 code. Use a font editor (ex: Type Light) to create a new font including this glyph.
  4. In Type Light, look for Latin I set, then look for character #160.
  5. Double-click on it: now you can edit an empty character (space-like).
  6. Just move the green line (on the right of the red line) halfway to the left. It creates a smaller space character.
  7. Save the font. Right-click on the file, select "Install". When prompted "overwrite?", select "yes".
  8. Restart Flash and re-publish your SWF.
Normally you now have pretty nbsp characters.

4 comments:

  1. I read a article under the same title some time ago, but this articles quality is much, much better. How you do this.. play motu patlu games

    ReplyDelete
  2. In order to evaluate all the advantages of this method, it is necessary to clearly understand what it has better parameters than the others.

    ReplyDelete
  3. I think that the report fully describes the method and is one of the best approaches to improve the situation!

    ReplyDelete



© Gludion/Olivier Besson - 2007