Using StageText for AIR applications

Adobe AIR 3 includes a great new feature: StageText. Using the normal TextField for text input works just fine, but this new TextField-like class allows you to control your text input more closely (especially on mobile devices) with many options like auto capitalization, software keyboard type, and more. It has its caveats (it’s a separate class, and it gets added to the top of the stage, so there’s no display list control) but overall it’s a great feature addition to Adobe AIR and the Flash platform as a whole.

Only that when I was trying to use it (with Flex 4.5 and AIR 3), it wouldn’t work, but instead fail with this error message during execution (even though StageText was included on airglobal.swc):

Exception fault: VerifyError: Error #1014: Class flash.text::StageText could not be found.

An online search for the error and its meaning provided no results (!) – information on the new class is pretty hard to come by. So after some trial and error (and luckily stumbling into this video about setting up FDT for Adobe AIR 3 and Flash Player 11 development), the reason is: you need to tell the Flex SDK compiler to compile against a newer version of the SWF format that enables that feature.

So the solution is simple: just add this parameter to your Flex SDK compilation settings (this is in addition to any target-player switch already present).

--swf-version=13

It should then work flawlessly.

Stage Text example

Read more about that switch here. The same applies when using StageVideo.

5 responses

  1. Hi,

    How would this work for application from flash
    I have searched but can not find the way
    thanks

  2. Also, when you’re using non-native input method in your mobile device, such Swype in Android, there’s a lot of problem using Flash text field input, which is solved by using StageText.

Comments are closed.