Posted by rollingsj in SWF Studio V3 on Jul 17 2008, 08:58 am

Is there a way to determine when the application window has finished maximizing after a call to Win.maximize? In Flex, it seems the callback fires immediately after making the call, but before the window actually changes size.

We've tried the window events, but onStateChange and onResize only seem to fire if the window is visible. Ours is hidden, as we'd like to position all of the components appropriately before showing the interface, otherwise there are noticeable changes when the app starts. Incidentally, even if the window is visible, onStateChange still fires before the window dimension properties have been updated.


Posted by northcode in SWF Studio V3 on Jul 17 2008, 09:26 am

The OnStateChange event will fire as soon as the window state has changed, not when Flash catches up and has finished updating - that's obviousl going to vary based on how much work you're making Flash do.


Posted by rollingsj in SWF Studio V3 on Jul 17 2008, 10:20 am

I understand that SWF Studio does not detect when Flash has completed its resizing routines, but if the application window is hidden, then a call to Win.getSize returns incorrect results.

Ideally, we could get and set the window dimensions while the window is still hidden. This would allow us to size the Flash components to correctly fit within the maximized window area before the window is ever shown. When resizing of the Flash components is complete, then we can call Win.show, and the user never sees the inital sizing, etc.

Here are some examples to illustrate the issue...


// window is hidden by default, and when the callback fires, the output
// is incorrect because the window has not been shown yet
   
private function appCreationCompleteHandler(event:Event):void {
   
   // maximize the application window
   ssCore.Win.maximize({}, {callback:winEventHandler}, {sync:false});
   
}
   
public function winEventHandler(returnObj:Object, callbackObj:Object, errorObj:Object):void {
   
   // output the window dimensions
   var return_obj:Object = ssCore.Win.getSize();
   ssDebug.trace(return_obj.width + ", " + return_obj.height);
   
   // show the application window
   ssCore.Win.show();
   
}



// window is hidden by default, and when the callback fires, the output
// is correct because the window is shown first
   
private function appCreationCompleteHandler(event:Event):void {
   
   // maximize the application window
   ssCore.Win.maximize({}, {callback:winEventHandler}, {sync:false});
   
}
   
public function winEventHandler(returnObj:Object, callbackObj:Object, errorObj:Object):void {
   
   // show the application window
   ssCore.Win.show();
   
   // output the window dimensions
   var return_obj:Object = ssCore.Win.getSize();
   ssDebug.trace(return_obj.width + ", " + return_obj.height);
   
}



// window is hidden by default, and the result is an application hang
// because the onStateChange event never fires since the window
// is not visible
   
private function appCreationCompleteHandler(event:Event):void {
   
   // listen for window event   
   ssCore.Win.setNotify({event:"onStateChange"}, {callback:winEventHandler}, {sync:false});
   
   // maximize the application window
   ssCore.Win.maximize();
   
}
   
public function winEventHandler(returnObj:Object, callbackObj:Object, errorObj:Object):void {
   
   // output the window dimensions
   var return_obj:Object = ssCore.Win.getSize();
   ssDebug.trace(return_obj.width + ", " + return_obj.height);   
   
}



// window is hidden by default, and the onStateChange event fires
// because we make a call to Win.show, and the output is correct,
// but we see the application window changing size
   
private function appCreationCompleteHandler(event:Event):void {
   
   // listen for window event   
   ssCore.Win.setNotify({event:"onStateChange"}, {callback:winEventHandler}, {sync:false});
   
   // show the application window
   ssCore.Win.show();
   
   // maximize the application window
   ssCore.Win.maximize();
   
}
   
public function winEventHandler(returnObj:Object, callbackObj:Object, errorObj:Object):void {
   
   // output the window dimensions
   var return_obj:Object = ssCore.Win.getSize();
   ssDebug.trace(return_obj.width + ", " + return_obj.height);
   
}