Workaround for PPSChannel error when running QNX PlayBook specific APIs on the Desktop
First thing is to note this is a workaround and might not work in the future or might not cover all the errors you might see. Take the simple use case of creating an AIR application for PlayBook and with a qnx.ui.text.TextInput
component in the display list. Because the qnx.ui.text.TextInput
class allows you to define which PlayBook KeyboardType is shown on the device it must call out to a PlayBook specific AIR API. If you try and run this application on the desktop you will see this error:
This error is because the AIR runtime on the desktop does not have a qnx.pps.PPSChannel
class, this class is specific to the PlayBook version of the AIR runtime that RIM has extended in their BlackBerry Tablet OS.
Ok, so what if you still want to run it on the desktop to work on UI layout an not necessarily full functionality?
This is the workaround to do just that, and again this might not work for all PlayBook specific API’s and for sure some features of QNX UI components might not work correctly. But its useful for UI design work without having to publish out to the simulator a bunch of times.
We’ll be working with this ActionScript based PlayBook application that just adds a qnx.ui.text.TextInput
to the display list.
{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import qnx.ui.text.TextInput;
public class PPSChannelTest extends Sprite
{
public function PPSChannelTest()
{
super();
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
var input:TextInput = new TextInput();
addChild(input);
}
}
}
First thing to do is in your Flash Builder project go into Project -> Properties -> Build Path. And change the qnx-air.swc to be “merged into code” instead of “external”. See the images below:
Now that the classes are merged into the application SWF we can monkey patch the qnx.pps.PPSChannel class. To do this go to New -> Package and fill with “qnx.pps” as seen below:
The next step is to create an ActionScript file by going to New -> ActionScript File. You can’t create a New -> ActionScript Class because the dialog will error out saying the class is already there in qnx-air.swc. So create a new ActionScript blank file in the qnx.pps package folder and call it PPSChannel. Then open up the file and copy this code into it:
{
public class PPSChannel
{
public function PPSChannel()
{
}
}
}
Now save the files and project make sure it does a new compile and run it on the desktop. You should be able to see the qnx.ui.text.TextInput
box on the desktop.
Pingback: Tweets that mention @renaun posts: Workaround for PPSChannel error when running QNX PlayBook specific APIs on the Desktop -- Topsy.com
Pingback: Working with PlayBook QNX UI components : Mihai Corlan
Pingback: Working with PlayBook QNX UI components (Adobe Flash Platform Blog)
Pingback: Cool Stuff with the Flash Platform – 2/10/11 | Finding Out About
Pingback: @renaun posts: PlayBook QNXApplication SWIPE_DOWN in a multi platform SWF