Resources | Resources |




OverlayOn indicates that the device is being animated and the device screen images will be sent to the SWF's display. Flash/Flex then keeps the display screen in sync with rest of the device. Returns the number of times OverlayOn(false) is called minus the number OverlayOn(true) is called. The return value is provided primarily for debugging purposes.


public function OverlayOn(on:boolean, testingSeconds:uint = 0):int

Host function

Function name: "OverlayOn"


  • on:Boolean,
  • testingSeconds:uint = 0

The first parameter 'on' indicates whether the Overlay should be on or off. The second parameter 'testingSeconds' is optional and only used when turning the Overlay back on.

Flash animations typically return from animating a sequence just before it is done (at least 1 frame before it is actually finished), whether the SWF is written with frames or not. The C# overlay has a faster refresh rate. To eliminate misalignments between the Simulator's overlaid device screen and the SWF device, testingSeconds can be set to greater than zero so that the ActionScript library will set a timer and test whether the screen has stopped moving. It will then tell the Simulator that animation has ended and the C# overlay can be shown again. This ensures that the device screen images go to the C# overlay. The timer will keep checking for movement, and send Resize if movement is found until the timer expires. At the end of the timer, it will send ResumeOverlay if it has not done so already, and the timer stops.

If testingSeconds is set to 0 no timer is started. The return value is provided for debugging. When the count is greater than 0 this function immediately returns the count. This code only executes when the count reaches 0, and will not decrement below 0. In testing Flash animations it has been observed that starting new animations before previous animations have finished may or may not result in the same number of ResumeOverlay being called as SuspendOverlay. Therefore, when the Flash code is certain all animations are done, it should call ResumeOverlay until ResumeOverlay returns 0.