Posts Tagged ‘actionscript’

Handling clipboard events in AIR

Tuesday, July 27th, 2010

So!

If you read that last post, you know about Tyro. Since I designed Tyro to be able to handle clipboard events, I expected it to respond to my cut, copy and paste keystrokes when I put it in an AIR application. It didn’t work. Can you think of why?

If you guessed it had something to do with menus, you’re correct. You seem pretty clever; maybe you want to follow along and try this project at home? Clipboard commands are usually provided through the Edit menu of an application, such as a web browser. Most people have learned through experience to rely upon the common keyboard shortcuts that software developers commonly bind to the clipboard commands, but know this: if your browser’s developer didn’t think to include that overlooked Edit menu, all your absent-minded key tapping would do nothing. (more…)

Overthinking Text

Tuesday, July 27th, 2010

Remember 2008? What a great year. Especially in November, when we made history. I remember watching the ceremony on video feed with friends. People were cheering and crying.

No, wait. I mean 2007, not 2008. You know, when Adobe showed us a sneak peek of Flash Player 10, and Peter Elst’s posted video coverage gave his blog a bazillion hits as Flashmongers everywhere watched Emmy Huang spin a MovieClip in 3D. “Whoop dee doo”, you might say with hindsight-equipped eyes. It’s 2010 and all those new tricks are now old hat, right?

Not exactly. While the novelty of 2.5D and IK handles may have faded away, one of Flash Player 10’s new features– the advanced text engine– has lagged behind the rest. That’s because the text engine is very low-level, and wasn’t exposed to designers in the Flash Professional authoring environment. Until CS5 was released this past April, only developers had access to the FTE. That’s kind of ridiculous, and Adobe knew that. And so began the efforts (by many different people) to bring TextField-like usability and new text functionality to the Flash platform. (more…)

Getting good vector shapes out of Flash embeds

Saturday, February 27th, 2010

A recent project I’ve been working on utilizes a couple faces from M+, a beautiful FOSS font set. There are several ways to embed fonts in Flash, and I prefer using the [Embed] meta-tag, which plays nice with the majority of the IDEs out there. However, a straight-up font embed tag wasn’t working well at all for me. The text that appeared onscreen was broken and misshapen in places.

It turns out that mxmlc, the Flash compiler, employs several “font managers” for taking embedded font files and “transcoding” them into Flash fonts. The primary manager relies on a Java library called Batik to convert the letterforms of the font file into Flash-friendly curves. I’m not sure why this was the case, but Batik was flummoxed by some of the faces in M+, specifically with the capital ‘O’ letterform.

I mean, you could trace a big O by hand if you wanted to. It’s cake. I can’t imagine why M+’s ‘O’ is so difficult to process, but if it can happen with this font, it could happen to any font.

I only managed to get good shaped text with one font manager- the one that also handles transcoding OpenType fonts and such, which uses the new Compact Font Format (CFF) system in Flash 10. (To learn more about this subject, here’s a post about the new CFF embedding system.)

It might seem subtle, but when you compare the text side by side, I think you’ll agree that all this CFF stuff I had to do was worth it. Below is the same SWF, one with M+ text imported with Batik, the other with CFF. (more…)

GOTO Addendum

Sunday, February 22nd, 2009

With all this talk of GOTO, it’s suddenly occurred to me that ActionScript has a direct, higher-level version of GOTO that causes Flash projects to succumb to the same problems as those affected by the original.

Do gotoAndPlay() and gotoAndStop() ring any bells, anyone? Dijkstra’s commentary on how a dynamic, running process can be conceptually connected to static source code essentially describes the same relationship between a Flash animation and its keyframes. And old Flash code that uses gotoAndPlay() extensively experiences the exact same pitfalls that old programs did that extensively used GOTO.

In fact, I completely agree with EWD- that although these functions are extremely useful, the quality of a Flash program generally correlates with the frequency of gotoAndPlay() and gotoAndStop() in its source code. I know this from personal experience; it wasn’t until I expanded my knowledge of ActionScript and began using structured code that I could really achieve anything in the medium. (more…)