Posted By

rrkrishrr on 03/06/13


Tagged


Versions (?)

Ipad Allow Only Landscape Orientation


 / Published in: ActionScript 3
 

Ipad Allow Only Landscape Orientation

  1. //......................Allow only Landscape Orientation...................
  2. //........................R.Ramakrishnan...................................
  3. //........................Flash Developer..................................
  4. //........................IRIPL Ltd.(Mumbai-India).........................
  5.  
  6. var startOrientation:String = stage.orientation;
  7. if (startOrientation == StageOrientation.DEFAULT || startOrientation == StageOrientation.UPSIDE_DOWN)
  8. {
  9. stage.setOrientation(StageOrientation.ROTATED_RIGHT);
  10. }
  11. else
  12. {
  13. stage.setOrientation(startOrientation);
  14. }
  15.  
  16. stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGING, orientationChangeListener);
  17.  
  18. function orientationChangeListener(e:StageOrientationEvent)
  19. {
  20. if (e.afterOrientation == StageOrientation.DEFAULT || e.afterOrientation == StageOrientation.UPSIDE_DOWN)
  21. {
  22. e.preventDefault();
  23. }
  24. }

Report this snippet  

You need to login to post a comment.