views:

394

answers:

3

I have a flash application running Flash 9 (CS3). Application is able to control the Softkeys when this flash application is loaded in the supported mobile device. But, the application doesn't have control when the same is embedded in HTML page and browsed via supported mobile device. Any ideas how to make this work?

Thanks Keerthi

+1  A: 

There is no special way to receive soft key events when embedded in HTML - if the browser/OS gives the events to Flash, then you can catch them like any other key event:

var myListener = new Object();
myListener.onKeyDown = function() {
    var code = Key.getCode();
    if (code==ExtendedKey.SOFT1) {
        trace("I got a soft key event");
    }
}
Key.addListener(myListener);

However, you'll find that most phones/browsers will not give you soft key events when your SWF is embedded in HTML. This isn't part of the Flash Lite spec - strictly speaking I believe they could give you those events if they wanted to, but most phones simply use those keys for browser functions, and consume them before they get to Flash.

Note that you can check at runtime whether or not softkeys are available:

trace(System.capabilities.hasMappableSoftKeys);
trace(System.capabilities.softKeyCount);
fenomas
A: 

Sorry for not being clear. I meant receiving the events in Flash lite. Could you please guide what steps need to be taken to enable flash lite receive the events.

Thanks for the clarification - I edited to answer your question fully.
fenomas
A: 

If you use a switch statement, you can have more than one keycode associated with an action, you make a desktop version for testing too. I have done it myself.