AIR Mobile TextInput/TextArea Key Events

Another quick one comin at ya!

When working on porting over my very first foray into Flex, my Flex particle engine, to the more current Flex4.6 for mobile purposes, I realized I wasn’t getting key events or change events from a debug Spark TextInput!

Simple As?

  <fx:Style>
    @namespace s "library://ns.adobe.com/flex/spark";

    s|TextInput {
      skinClass: ClassReference("spark.skins.mobile.TextInputSkin");
    }
  </fx:Style>

Tell your TextInput classes to use the standard TextInputSkin. The same applies for TextAreaSkin.
If we look in our defaults.css for the mobiletheme, we’ll see that it’s normally set to: spark.skins.mobile.StageTextInputSkin.

Why?

StageText allows some nice features, such as dictionary completion from the OS and better keyboard support for alternative keyboards, to advanced features like quick zoom and fancy selection support that each OS provides. But it ruins the Events that one would expect that it dispatches.

I don’t know if this is true for ALL events, but certainly it is true for KeyboardEvent.KEY_UP, KeyboardEvent.KEY_DOWN, and Event.CHANGE. Bummer!

In my case, the loss of the native features isn’t that big of a deal right now… Right now.
Eventually we’ll need a formal solution for this if we’re going to rely on StageText at any point.

Oh, and by the way…

My Flex particle engine is working rather well so far on my tablets and phones, even with it’s nasty memory leak!

Once I clean it up, I’ll release a public APK for everyone to test on Android!

Advertisements

About killerspaz

I'm a developer that loves to tinker with cutting edge technology. I have recently been playing with the Flash Platform (AS3/Flex), Android (custom roms, replacement apps, scripting), and looking at opportunities in the mobile markets.

Posted on 01.14.2012, in AIR Mobile, Flash Player and tagged , , , , , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: