Blastanova

January 15, 2011

Use Flash Text Engine in MX Components in ANT

Filed under: Uncategorized — admin @ 3:04 pm

The title of this post is what I googled endlessly for like 2 hours trying to figure out how to do this.

Hopefully you’ll come here when you google this and get the answer you need. For you fine folks, I’ll save you some time. Add this to your compiler options:

<theme dir="${FLEX_HOME}/frameworks/projects/spark" append="true>
     <include name="MXFTEText.css" /> 
</theme>

For the rest of you – maybe you’d like to know what this is or get a little more background.

“Use Flash Text Engine in MX Components” is a setting you can check in the Flash Builder compiler options for a project. Old style Halo (MX) components from Flex 3 use the old text engine.

As of Flex 4, we have a brand new text engine. Unfortunately, Adobe hasn’t completely written all the new components yet for Flex 4 (Spark). This means that your Flex 4 project will probably have a mix of Spark and Halo (MX) components.

One of the most frustrating things about this mix for me is working with fonts. For Spark components, you need to embed your fonts in the Compact Font Format (embedAsCFF=true). For MX components, you need to embed your fonts as non CFF (embedAsCFF=false). This could potentially mean embedding one set of fonts for your MX components and another set for your Spark Components.

Not only does this increase your application size, but it can get really hairy trying to work with styles. You need to identify all components that use Halo/MX components and tell them to use the correct font. If you go low level like label, you need to recognize that things like Alerts are MX components and they use MX labels, while if you just make a Spark label, you’ll be using Spark. So this means creating separate styles for s|Label and mx|Label.

Fortunately, Adobe made a workaround in our MX components. They allow you to use the new text engine in your MX components by checking the “Use Flash Text Engine in MX Components” option in Flash Builder.

While that’s great in Flash Builder, what if you want to use this option outside of Flash Builder? What if you want to do a command line compile, or better yet create an ANT build file.

For the command line option, information is relatively easy to find:

http://help.adobe.com/en_US/flex/using/WSda78ed3a750d6b8f-26a13bbf123c441239d-8000.html

Basically just use the theme argument and add a theme to the compiler options
-theme+=myflexhome/frameworks/projects/spark/MXFTEText.css

This is a special CSS file that Adobe made just for this purpose.

I was a little stumped on how to put it in an ANT build script, though. I tried:

<theme dir="${FLEX_HOME}/frameworks/projects/spark"> 
   <include name="MXFTEText.css" /> 
</theme>

Unfortunately, this completely replaces the theme, and doesn’t add a CSS file to your themes. It worked decently enough for my project (save all the warnings I got).

Luckily another guy on my project, TJ Downes figured out that if you use the “append=true” ANT tag option, you can make this property additive, so you end up with:

<theme dir="${FLEX_HOME}/frameworks/projects/spark" append="true>
     <include name="MXFTEText.css" /> 
</theme>

So there you have it. I couldn’t find this anywhere, so hope this helps you!

January 12, 2011

Be a Subject Expert (in something else)

Filed under: personal,projects — admin @ 1:00 am

Next week, my user interface user group, tri-me.org will be having our first meeting of the year. Rachel Nabors will be presenting on Wabi-Sabi in web design. Many times, a user group (ourselves included) will have a very technical presentation. How do you make the best MVC database application? How do you do memory management in Flex?

BLAH BLAH BLAH

I haven’t seen Rachel’s presentation yet, but it got me thinking about how inwardly focused web designers, developers, application programmers, etc are with our craft. Rachel is breaking out of this, and I think it’s a thing that some of us do to not go crazy – but I don’t think we realize how professionally useful it can be to break out of this.

Many of my friends and peers can do some amazing things behind a keyboard – both artistically and technically. We stay appraised of what Apple did to Adobe, what Google did to Apple, what the newest web framework is, and why it sucks. Our personal projects range from innovative ways to make a content management system, access a database, or log memory management in a project. We compete with each other in good AND bad ways and aspire to be the smartest kid on the block.

This is all great. We’re “keeping up with our industry”. We’re chasing technology after technology and remaining marketable. I wouldn’t have survived this long if I didn’t love the thrill of doing something innovative with new tech.

But guess what? We can’t relate to anybody but ourselves. We’re either magical in the ways we can work a computer, scam artists with how much we charge, or both to people outside our circle. This really isn’t too much of a problem professionally if you’re great at what you do, but how good is it really?

My wife is a writer, and to be honest, the profession bores me. I don’t care about grammatically correct, mapping plot points, sentence flow, etc. To her credit, though, she doesn’t write long essays about grammar. She writes things that non-writers can relate to, and she uses the knowledge of her craft to reach out to an audience that has no idea how to write.

Words are a medium to be shaped to send a message, just like pixels are. But if all we know is our craft, what kind of message can we send? Do we create a message only our peer group can understand, or do we rely on other people to tell us what message to create?

We all have hobbies – sometimes our hobbies are database programming. But other times, our hobbies are things that everyone can enjoy like wine, music, dining, television, or Japanese art history. Our hobbies can have a way of looping back into our professional lives and we suddenly have a message, and the knowhow of our craft to push those pixels and send that message.

Some examples….

My ex-employer 360KID was founded by Scott Traylor. He was interested in kids, their play, and how to use toys for education. He also happened to be a pretty decent web designer. He could have stayed a web designer, and just took whatever work came his way. Instead, he focused on children’s education and entertainment, because it was what he was interested in. Eventually 360KID was in the very unique position of being an award winning technology and design company with intimate knowledge of how to push those pixels so kids could learn. Since he was a subject expert (in something else), we were one of the best companies in the country to go to if you wanted to design something educational for kids.

Tom McCay, a NC local who I’ve met on several occasions, works at a company called rPath. They create build systems for programmers like me. BUT, Tom is passionate and knowledgeable about wine and beer. This led him to create winebythebar.com – a unique rating, review, and organizational mobile tool for wine that you can use by scanning bar codes. Tom is a subject expert (in something else). He’s a smart guy, and could get hired at any tech savvy software development company he wanted to work at. But on top of that his expertise make give him an extremely unique skillset that most likely only he possesses. He can go after these kinds of specific business opportunities (and no doubt win them) because he turned a hobby into something more.

Me, I like music. I’ve been in bands, play the keyboard, and listen to bands you’ve never heard of. I’m not particularly good at any of this, but I am a web developer as well. As a result, I’m now writing music apps, music tech articles, and doing cool stuff that nobody else does – because I’ve turned myself into a subject expert (in something else).

I think in the end, our unique qualities keep us sane and give us perspective. The more we keep ourselves pointed inward, the less unique we are. There’s only so many directions we can go in our design/development fields, and we become worth a dime a dozen because there’s hundreds of other people out there that can structure a database AND make cool icons.

The farther we reach outside our professional zone, the better chance we have of being unique and gaining this perspective. Sometimes having this unique perspective is the THING that makes us marketable regardless if this unique perspective is in music, wine, or Japanese art.

So my advice, for whatever it’s worth, is to be a subject expert (in something else).

Powered by WordPress