Tagged with Flex

All about Flash Versions

by

Here is a really great article by Senocular about the different versions of the Flash Player, authoring tool, ActionScript, Flex, SDK, compiler, etc. The whole thing has gotten so complex that we really need something like this to keep track.
http://www.senocular.com/flash/tutorials/versions/

Tagged , , , , , ,

Using %tokens% with Flex resource bundles

by

When I use Flex, I make extensive use of Resource Bundles for all but the most basic applications. In short, they allow you to keep all of your static string values (and non-string values) separated out of your code. That way, down the line it’s a very easy change when you want to localize the site in another language, rebrand it for another audience, or when a client asks you to change a button label or error message. Granted, this level of detail isn’t always necessary but I think it’s a good habit to get into even if it’s overkill for some projects.

But resource bundles can’t help you in every scenario. I often find myself needing to construct a sentence with live data inserted. For this, the resource strings are less helpful. For example, how would you write:

"At " + time + ", you received a message from " + userName + "."

With resource strings, you would have to do something like

at=At
message=, you received a message from
period=.

Which completely negates the whole point of using resource bundles. What to do?

Token replacement

tokens
What I really wanted was a way to inject data into the string. I’ve seen this done by use of tokens in other languages like Objective-C so I thought I’d give it a try. The result was surprisingly lightweight.

I created this utility that lets you use tokens (delimited by % signs) that can be replaced by live data when you retrieve the resource. Using this class, the example above would look more like this:

receivedMessage=At %time%, you received a message from %userName%.

// then in your code
trace(ResourceStringUtil.getResoureceStringWithTokens("receivedMessage", {time: "11:49", userName: "Mims"}));

// displays
At 11:49, you received a message from Mims.

Here’s the source code Feel free to use it and modify it for your purposes.

Tagged , , ,

Using ant for Flex – a no B.S. guide – Part 4 of 4

by

Now that you’ve been through 3 exhaustive tutorials on ant for flex, it’s time to use your knowledge you’ve gained to turn your back on the built-in Flex compiler and switch to ant for your builds. This part applies to FlexBuilder (and FlashBuilder) users only although it may apply if you’re using some other eclipse-based plugin. If you’re using another program like TextMate or Flash CSx, you can skip this article.
Continue reading

Tagged , , , , , ,

Using ant for Flex – a no B.S. guide – Part 3 of 4

by

This third installment talks about tips and tricks for using ant with version control systems.
Continue reading

Tagged , , , ,

Using ant for Flex – a no B.S. guide – Part 2 of 4

by

In this part, I get more nitty-gritty about working with flex’s ant tasks.
Continue reading

Tagged , , , , ,