2014/01/03

Happy new year

Désolé, j'avais complètement oublié que j'avais un blog! Bonne année à mes abonnés :D

2012/09/04

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.