Permalink
Browse files

Fixed resize logic for examples (iDevices bug?)

  • Loading branch information...
1 parent f3787d0 commit 78f0acaf50a55f1630ecc2ba055acea594a434e2 @fljot committed Mar 30, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 src_examples/views/ExampleViewBase.as
View
15 src_examples/views/ExampleViewBase.as
@@ -1,5 +1,8 @@
package views
{
+ import flash.events.TimerEvent;
+ import flash.utils.Timer;
+ import flash.utils.setTimeout;
import model.ExamplesModel;
import spark.components.Button;
import spark.components.Group;
@@ -30,6 +33,7 @@ package views
[Bindable]
protected var dataModel:ExamplesModel;
+ private var resizeTimer:Timer;
public function ExampleViewBase()
@@ -52,6 +56,9 @@ package views
actionContent = [demoButton];
}
+ resizeTimer = new Timer(10, 1);
+ resizeTimer.addEventListener(TimerEvent.TIMER, resizeTimerHandler);
+
addEventListener(ResizeEvent.RESIZE, resizeHandler);
addEventListener(FlexEvent.INITIALIZE, initializeHandler);
addEventListener(ViewNavigatorEvent.VIEW_ACTIVATE, viewActivateHandler);
@@ -171,6 +178,14 @@ package views
private function resizeHandler(event:ResizeEvent):void
{
+ // because on iPad stage.stageWidth/stageHeight still gives wrong values for some reason
+ resizeTimer.reset();
+ resizeTimer.start();
+ }
+
+
+ private function resizeTimerHandler(event:TimerEvent):void
+ {
onResize(width, height);
}
}

0 comments on commit 78f0aca

Please sign in to comment.