I was working with a PopUp window today in Flex 4.1 and was experiencing some wonkiness when I pressed the ‘tab’ key.  Expecting the focus to move from one textinput field to the next, instead, the focus went back to the containing window.  My pop-up window was modal, so this is not what I expected.

My ninja google skillz returned the following fix I thought I’d share with you.  You can find the fix here at DoubletMedia.

I attempted his fix var fm:FocusManager = new FocusManager(this); fm.activate(); in my popup using Flex 4.1 and got the following compiler error:

Description Resource Path Location Type
1067: Implicit coercion of a value of type com.mgh.app.Prompt to an unrelated type mx.managers:IFocusManagerContainer. Prompt.mxml /app/src/com/mgh/app/view line 43 Flex Problem

The documentation for IFocusManagerContainer states:

“The PopUpManager automatically installs a FocusManager in any IFocusManagerContainer it pops up.”

So rather than manually instantiating a FocusManager, I implemented the IFocusManagerContainer in my popup:

<s:Group ... implements="mx.managers.IFocusManagerContainer" ... >
<fx:Script><![CDATA[


import mx.core.IFlexDisplayObject;
protected var _defaultButton:IFlexDisplayObject;
public function get defaultButton():IFlexDisplayObject {
return _defaultButton;
}
public function set defaultButton(value:IFlexDisplayObject):void {
_defaultButton = value;
}
]]></fx:Script>

I just ran into an issue while migrating an app from Flex 3.5 to Flex 4.1.  I noticed that screens using mx:Text to display htmlText were blank.  Baffled, I performed the old trusty google search.  And found here and here that Flex 4 uses a new standard for font embedding.  The long and short of it, if you use spark components use an embedded font with a embedAsCFF:true; otherwise, Flex 3 MX components should use embedAsCFF:false;


@font-face {
src:url("../assets/fonts/Copperplate.dfont");
fontFamily: myCopperPlate;
font-weight:normal;
}
@font-face {
src:url("../assets/fonts/Copperplate.ttc");
fontFamily: myCopperPlate3;
font-weight:normal;
embedAsCFF: false;
}

Researching Flash Text Engine

I’m researching the new magical properties of the Flash Text Engine (FTE) and stumbled across these two great articles:

‘The Flash Text Engine Part 1′ by Paul Talyor
http://guyinthechair.com/2010/06/the-flash-text-engine-part-1/

EDIT: Turns out Paul Taylor is a FTE rockstar… more articles here: http://guyinthechair.com/category/actionscript/

‘Flash Text Engine’ by Veronique Brossier
http://insideria.com/2009/03/flash-text-engine.html

good eats.

I’m getting an strange intermittent error when attempting to use ResourceBundle/ResourceManager in my Reflex app for localization.  ResourceBundle is, of course, a flex component and so it appears some flex bundles are sneaking in to the party through the binding interface…

Could not find compiled resource bundle 'core' for locale 'en_US'.
at mx.resources::ResourceManagerImpl/installCompiledResourceBundle()[E:\dev\4.x\frameworks\projects\framework\src\mx\resources\ResourceManagerImpl.as:340]
at mx.resources::ResourceManagerImpl/installCompiledResourceBundles()[E:\dev\4.x\frameworks\projects\framework\src\mx\resources\ResourceManagerImpl.as:269]
at mx.resources::ResourceManagerImpl/supportNonFrameworkApps()[E:\dev\4.x\frameworks\projects\framework\src\mx\resources\ResourceManagerImpl.as:948]
at mx.resources::ResourceManagerImpl/findBundle()[E:\dev\4.x\frameworks\projects\framework\src\mx\resources\ResourceManagerImpl.as:916]
at mx.resources::ResourceManagerImpl/getClass()[E:\dev\4.x\frameworks\projects\framework\src\mx\resources\ResourceManagerImpl.as:901]
at Function/http://adobe.com/AS3/2006/builtin::apply()

… snip …

I tried including the flex framework bundle path and adding -include-resource-bundles MobileFlashCards, core, effects, skins, styles to my compiler path to no avail.

So plan B.  Fake out the compiler.  The flex framework uses four base ResourceBundles (as far as I can tell.)  So, I created four empty property files in my locales/en_US folder.

I then included the [ResourceBundle()] meta tag for each of the four core bundles in my <rx:Application file:

[ResourceBundle("core")]
[ResourceBundle("effects")]
[ResourceBundle("styles")]
[ResourceBundle("skins")]

Now I use my [ResourceBundle("MobileFlashCards")] as expected in my skins: No errors.

If anyone has a better solution, I’m all ears!

2010 was a day of soul searching and self discovery for the Flash platform developer.  Back in April, I wrote my ‘Lament of a Flex Developer‘ essay.  I had been devastated by Apples refusal to allow Flash built software into the AppStore and had a good cry (no not really, but I wanted to.)  All my evangelism on the benefits of a unified runtime that would bridge the gap between desktop, web and mobile suddenly seemed in vain.

Well flash forward a few months later, get the SEC involved and suddenly Apple has a change of heart.  My quest for the holy grail of app development is back in business.

So, I have dived head first into the world of Flash development for mobile.  My glorious plan is to develop a Flash based app that I can write once and deploy to iOS (iPhone/iPad), Android (phone and tablets), web, desktop pc and mac.

First thing they tell you in “Packager for iPhone Camp” is not to use the Flex SDK.  This scared me for two reasons: I’ve spent the last 3 years solidly in the Flex world.  Second, I hate the Flash CS# IDE.   So until this fabled Flex Mobile Framework arrives, I decided to scour the internets for a Flex alternative that will allow me to continue using Flash Builder 4.

Enter, ReFlex.  Lightweight, fully extensible, pay as you go, allows me to use MXML, awesome;  but not complete. Looks like my work is cut out for me.

And now to choose the framework.  I hate frameworks.  They’ve gotten better of course, they used to be controlled by some god-pattern config file, tedious and frustrating, now the config files are broken up into pieces and dependencies are ‘injected’. They’re called IOC (inversion-of-control) frameworks.  Which are awesome but not really my cup of tea.  Thankfully my friend Scot just created Trigger.cc (cc == Command and Control)  So rather than Parsley (which is rad) or Robot Legs (good name), I’m going to try and use Trigger.  You’ll notice that Scot’s site doesn’t contain the word “Enterprise” anywhere.  Just how I like it.

This is going to be fun.

Hello Internets

Ah yes, one more flash dev blog.  I hope I can be useful.  I’ve been in a Flash bubble the last ten years.  I look forward to meeting you all.