Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed resize logic for examples (iDevices bug?)

  • Loading branch information...
commit 78f0acaf50a55f1630ecc2ba055acea594a434e2 1 parent f3787d0
Pavel Pevnitskiy authored

Showing 1 changed file with 15 additions and 0 deletions. Show diff stats Hide diff stats

  1. +15 0 src_examples/views/ExampleViewBase.as
15 src_examples/views/ExampleViewBase.as
... ... @@ -1,5 +1,8 @@
1 1 package views
2 2 {
  3 + import flash.events.TimerEvent;
  4 + import flash.utils.Timer;
  5 + import flash.utils.setTimeout;
3 6 import model.ExamplesModel;
4 7 import spark.components.Button;
5 8 import spark.components.Group;
@@ -30,6 +33,7 @@ package views
30 33
31 34 [Bindable]
32 35 protected var dataModel:ExamplesModel;
  36 + private var resizeTimer:Timer;
33 37
34 38
35 39 public function ExampleViewBase()
@@ -52,6 +56,9 @@ package views
52 56 actionContent = [demoButton];
53 57 }
54 58
  59 + resizeTimer = new Timer(10, 1);
  60 + resizeTimer.addEventListener(TimerEvent.TIMER, resizeTimerHandler);
  61 +
55 62 addEventListener(ResizeEvent.RESIZE, resizeHandler);
56 63 addEventListener(FlexEvent.INITIALIZE, initializeHandler);
57 64 addEventListener(ViewNavigatorEvent.VIEW_ACTIVATE, viewActivateHandler);
@@ -171,6 +178,14 @@ package views
171 178
172 179 private function resizeHandler(event:ResizeEvent):void
173 180 {
  181 + // because on iPad stage.stageWidth/stageHeight still gives wrong values for some reason
  182 + resizeTimer.reset();
  183 + resizeTimer.start();
  184 + }
  185 +
  186 +
  187 + private function resizeTimerHandler(event:TimerEvent):void
  188 + {
174 189 onResize(width, height);
175 190 }
176 191 }

0 comments on commit 78f0aca

Please sign in to comment.
Something went wrong with that request. Please try again.