Embedding Fonts In Flex – Tip

Short and sweet, if you want to know the Unicode ranges for various glyphs, such as Latin 1, Cyrillic and so on, open up flash-unicode-table.xml from your “Flex SDK/frameworks/” directory.You’ll find everything listed, and it’s a good way to save on…

Short and sweet, if you want to know the Unicode ranges for various glyphs, such as Latin 1, Cyrillic and so on, open up flash-unicode-table.xml from your “Flex SDK/frameworks/” directory.

You’ll find everything listed, and it’s a good way to save on font size.

Characters Not Embedding With Flex DefineFont4

In a nutshell: Don’t try to use Windows TTF files when embedding fonts in Flex on OSX, possibly a CFF thing.Long version: I had a strange problem with font embedding in Flex Gumbo on OS X when trying to embed the following character ranges (using CFF…

In a nutshell: Don’t try to use Windows TTF files when embedding fonts in Flex on OSX, possibly a CFF thing.

Long version: I had a strange problem with font embedding in Flex Gumbo on OS X when trying to embed the following character ranges (using CFF):

																// numerals, full stop, lower, upper, punctuation, basic latin
[Embed(source='ttf/arial.ttf', fontFamily='Arial', unicodeRange='U+0030-U+0039,   U+002E,   U+0041-U+005A, U+0061-U+007A,   U+0020-U+002F,U+0030-U+0039,U+003A-U+0040,U+0041-U+005A,U+005B-U+0060,U+0061-U+007A,U+007B-U+007E', cff='true')]
public static var Arial:Class;

The first range (U+0030-U+0039) contains the numerals 0 through 9, but they were not being embedded in the resultant SWF. The TTF font I was using was Arial (regular) from my XP machine, this is because on a Mac you get a totally opaque “suitcase” file (dfont) for the whole family.

For some reason the numerals, in fact any punctuation characters, were not embedding; but letters were fine. I tested this with:

var font:Font = Font.enumerateFonts()[0] as Font;
trace(font.fontFamily + " has numerals: " + font.hasGlyphs("0"));

Very strange. Anyway the solution to this problem is to extract the TTF files from the Mac font suitacase files using Fondu (see Aral’s post on how to do this, it only takes a minute to install).

Then a simple “fondu Arial” in Terminal will extract the 4 TTF files (one for each style/weight), which will work with the DefineFont4 embedding process. Phew.

Flash Player 10 Coming to Mobile (en-mass)

Back in October 2007 I wrote a post entitled “Does Flash Lite Have a Future?” which is one of my most popular posts and it sparked some interesting comments. The main argument I had for this wasn’t that Flash Lite was going down the pan, it was simply th…

Back in October 2007 I wrote a post entitled “Does Flash Lite Have a Future?” which is one of my most popular posts and it sparked some interesting comments. The main argument I had for this wasn’t that Flash Lite was going down the pan, it was simply that we didn’t need it because the full Flash Player would be suitable for mobile due to touch-screen, higher powered mobile devices and lower power requirements for our applications anyway (the argument here is that we only use a tiny percentage of the CPU for most applications now unlike before).

Think about it another way. You can happily code a Flex application to work in the browser, or in the AIR runtime, I’m doing this at the moment. Both environments have special classes available, different properties on existing classes, but you know where you are with Capabilities.playerType, this same mechanism will help on mobile, and the mobile player itself will deal with user input/interaction differences as it does at present.


This announcement
from the GSMA Mobile World Congress seems to re-inforce this. I’m aware Flash Lite will continue to be used for the very low powered phones (the other end of the spectrum can hardly be called “phones” anymore when calling makes up a tiny fraction of what most kids use phones for now in the UK at least) but those’ll eventually shift to the full FP too. Windows Mobile, Google’s Android, Nokia S60/Symbian and Palm are the initial supported platforms. LG have signed up for 50 Windows Mobile devices by the looks of it, and I can see Android getting one hell of an adoption rate with OEMs struggling to compete against Symbian and iPhone, and the second that lower-end devices rise to meet the demands of Android, we’re in for a new boom era for Flash.

Adobe Releases Distributable Flash Lite 3.1 Player

A thorn in the side of Flash Lite has been removed. Today Adobe has released a developer redistributable version of the Flash Lite 3.1 player along with the packager tool. This greatly improves the situation of not knowing whether someone has the player,…

A thorn in the side of Flash Lite has been removed. Today Adobe has released a developer redistributable version of the Flash Lite 3.1 player along with the packager tool. This greatly improves the situation of not knowing whether someone has the player, and being helpless to get them it if they haven’t.

Read more here.

EDIT: I just tested this on my E71 by visiting m.adobe.com (thanks Scott), it works amazingly. Things may have been very different over the last few years of Flash Lite if this mechanism had been around. The application was small, installed quickly with only 1 nag, then prompted me to install Adobe Version Checker which installed Flash Lite 3.1 for me and immediately launched the game I had downloaded (Tower Bloxx). Good work! (Now for a Sony Ericsson version?).

Flash Lite 3.1 Distribution Workflow

Upgrading Flex 3/AIR Projects to Gumbo/Flex 4

This article is about creating Flex Gumbo (Flex 4) application that run in either Flash Player 10, or AIR 1.5. I also describe how to upgrade an existing FP9/AIR 1.0 application to use the new SDK. In my case I also had to upgrade a Flex Library project…

This article is about creating Flex Gumbo (Flex 4) application that run in either Flash Player 10, or AIR 1.5. I also describe how to upgrade an existing FP9/AIR 1.0 application to use the new SDK. In my case I also had to upgrade a Flex Library project so that’s also covered.

Word of warning: before you jump in please refer to the section entitled “Problem: Losing Syntax Highlighting in Script Tag” near the end. As this could affect you if you make use of Script tags rather than the “code-behind” technique (I now use the former strategy to save on files and promote simpler View classes).

Why use Gumbo?

Continue reading “Upgrading Flex 3/AIR Projects to Gumbo/Flex 4”

Two AIR Applications Reviewed – GoAir and LiveQuotes

I’ve just tested out a couple of new AIR applications using PureMVC from SourceBits, they’ve built up quite a few interesting apps in their portfolio, the two new ones being GoAir and Live Quotes.GoAir is an AIR application designed to provide a desk…

I’ve just tested out a couple of new AIR applications using PureMVC from SourceBits, they’ve built up quite a few interesting apps in their portfolio, the two new ones being GoAir and Live Quotes.

GoAir is an AIR application designed to provide a desktop Gmail experience, and offline mail support (including sending email when offline, and having it actually send when it detects a connection). This one caught my eye because I also wrote an AS3 Pop3 library and hooked it up to Gmail some time ago, alas mine did not have SMTP so you couldn’t send, and the UI was basic, this one has full SMTP/POP support so you can send and receive.
Continue reading “Two AIR Applications Reviewed – GoAir and LiveQuotes”

Getting Rid of If/Switch – Be a Better Coder

At my last job I met a software architect who, for a Flash project, jumped in and learned ActionScript in what must have been a few hours so he could work on the domain logic for a complex application. Just for background, I believe he primarily worked w…

At my last job I met a software architect who, for a Flash project, jumped in and learned ActionScript in what must have been a few hours so he could work on the domain logic for a complex application. Just for background, I believe he primarily worked with .NET but you know how programming works… hours spent * natural ability = language independent skill.

Suffice to say he was indeed an extremely good coder and I’m grateful he spent some time passing on a few tips and tricks that apply to all languages, and some nice demonstrations using Haskell, ActionScript and of course C#. One such tip was the use of “pure functions” for example, which is always in the back of my mind now. (As a side note, I think learning a very different language like Haskell or in my case Ruby is a great way of keeping your mind open and it will help with your “daily” language).

Another of those tips went something like this: “hey, you know these switch statements, you can pretty much get rid of switch statements in an OO application using polymorphism”. For those a little unfamiliar with that term, in ActionScript this could be achieved by subclassing a superclass several times. This statement turns out to be, on the whole, true. A switch statement can a lot of the time be reflective of a problem in the architecture, a coupling of code, and by simply introducing interfaces and polymorphism into the equation you can refactor it down to maybe 2 lines from however many switch-cases. Overall there may be more code in separate classes, but it’s a lot more elegant, maintainable, extensible, readable, and most importantly, testable.

That brings me to the subject of this post. Making testable code is actually one of the best ways of writing *better* code. The Google Testing Blog has some of the best posts I’ve ever read on the subject of better coding. The latest post is on the very subject discussed in this post.

The Google Testing Blog.

OS X Secret Spotlight/Search Syntax

I got a tip from my friend Alex Peretti regarding the built in search in OSX. Skip to the end if you are familiar with the default search pains.I couldn’t understand why, when you start typing in the search box inside any folder’s Finder window, it d…

I got a tip from my friend Alex Peretti regarding the built in search in OSX. Skip to the end if you are familiar with the default search pains.

I couldn’t understand why, when you start typing in the search box inside any folder’s Finder window, it defaults to searching inside files of the entire computer for matching text, instead of looking at filenames inside the current folder. That means every time I search for something I have to change the settings (they aren’t stored) because 99% of my searches seem to bring up some wordy Nietzsche e-book instead of what I’m looking for.

The screenshot below shows the default search options for context.

Finder Search

My guess is they do it like this so that search works almost every time for the average Joe who doesn’t tend to have thousands of source files and libraries (particularly given Spotlight is insanely fast anyway). Either way, for the power-user help is at hand. This search syntax works inside Spotlight or a Finder search:

  • name:hello – find files who’s filename contains “hello”
  • kind:action – find ActionScript files
  • date:today – find files modified today (or Apps used today)
  • date:>1/1/08 – find files modified after 1/1/08

No need for wildcards, although I imagine they work too. You’ll find Spotlight searches are now lightening fast and hopefully more relevant. Cheers Alex.

Update: There are more commands available, this page has a good summary.

Feed Your Mac

It’s that time of year again. “Give good food to your Mac” is back with another set of software to choose from. The twist is the more you buy, the cheaper it gets, literally. Choose 3 apps, save 30%, 4 gets you 40% but 5+ gets you 50% off. It’s time limi…

It’s that time of year again. “Give good food to your Mac” is back with another set of software to choose from. The twist is the more you buy, the cheaper it gets, literally. Choose 3 apps, save 30%, 4 gets you 40% but 5+ gets you 50% off. It’s time limited, so 10 days to go.

Last year I purchased 10 pieces of software for the price of the 1 piece I actually wanted (Unity 3D). In that package I also got an impressive casual 3D modeler, Cheetah 3D. It won’t replace Maya or MAX, but for a lot of tasks it’s perfect. Yes some of the apps on there are a little gimmicky, some of them you may never use, but it really doesn’t matter if you’re getting the other apps for free (in my case anyway).

So what’s on this years list? My picks would be:

  • Cheetah 3D – Fast 3D modeler, raytracer renderer and animation.
  • Toon Boom Studio – A well known fully featured animation package.
  • Hydra Aperture Plugin – HDRI images done fast.
  • Scribbles – One of those lovely little quick to use apps (see video).
  • MacPilot – Access 900 power-user/hidden Mac features, e.g. show hidden files (better than the AppleScript alternative perhaps.
  • Renamer – If you’re not a Terminal Guru, or want to save some braincells you might like this batch file renamer, if it saves you 30 minutes, ever, it’s likely paid for itself.

If you’re in the market for any of these or one of the other utilities on there you might consider the 50% off a deal clincher. Disclaimer: I have no affiliation with this site nor its creators.

Xuinet Mobile Flash Competition – $10,000 prize

Just got news from the guys at Xuinet that they’re running a big competition with a cash prizes totaling $10,000. You need to submit SWFs via email by November 3rd 2008 and multiple entries are allowed. Looks like a good opportunity to re-purpose your Fl…

Just got news from the guys at Xuinet that they’re running a big competition with a cash prizes totaling $10,000. You need to submit SWFs via email by November 3rd 2008 and multiple entries are allowed. Looks like a good opportunity to re-purpose your Flash Lite 2 content.

Prize categories include:

  • Blogs and Social Networks
  • Games
  • Images/slide-shows
  • Sports (scores, trivia, fantasy league)
  • On-the-go (travel, weather, news, etc.)

I must admit I haven’t seen Xuinet before. It appears to be a distribution platform for Flash mobile applications. By the looks of it the files are converted into a “Xui” which runs Flash 7 SWFs in a custom player on Windows Mobile devices. I’d be interested to hear from anyone who’s tried out the SDK to confirm the implementation details.

Best of luck to anyone entering the competition.