Using QNXApplication with PlayBook and non-PlayBook devices


/ Published in: ActionScript 3
Save to your folder(s)

If you want to use the PlayBook's QNXApplication SWIPE_DOWN event in a SWF that will be used on other devices, check out this code.


Copy this code and paste it in your HTML
  1. package
  2. {
  3. import flash.display.Sprite;
  4. import flash.display.StageAlign;
  5. import flash.display.StageScaleMode;
  6. import flash.events.Event;
  7. import flash.utils.getDefinitionByName;
  8.  
  9. import qnx.system.QNXApplication;
  10.  
  11. public class TestCC extends Sprite
  12. {
  13. public function TestCC()
  14. {
  15. super();
  16.  
  17. // support autoOrients
  18. stage.align = StageAlign.TOP_LEFT;
  19. stage.scaleMode = StageScaleMode.NO_SCALE;
  20.  
  21. try
  22. {
  23. var c:Class = flash.utils.getDefinitionByName("qnx.system.QNXApplication") as Class;
  24. var q:QNXApplication;
  25. c.qnxApplication.addEventListener("swipeDown", swipeDown);
  26. }
  27. catch(error:Error)
  28. {
  29. graphics.beginFill(0xFF3333, 1);
  30. graphics.drawRect(50, 50, 200, 200);
  31. graphics.endFill();
  32. }
  33. //QNXApplication.qnxApplication.addEventListener("swipeDown", swipeDown);
  34. }
  35.  
  36. protected function swipeDown(event:Event):void
  37. {
  38. // TODO Auto-generated method stub
  39. graphics.beginFill(0x3333FF, 1);
  40. graphics.drawRect(50, 50, 200, 200);
  41. graphics.endFill();
  42. }
  43. }
  44. }

URL: http://renaun.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.