So... I have a full-bleed video. In the interest of conserving overhead, I'd like to it to pause while the stage is being resized and resume playing once the resize is complete. Is there a simple way to detect when the stage is no longer being resized? Is there something about Event.RESIZE I'm not aware of?
Are you going fullscreen or is this just a window resize?
The reason I ask is you could experiment with StageDisplayState to see when it sets its FULLSCREEN or NORMAL value.....theoretically.
Just a window resize.
I considered MouseEvent before realizing that the mouse is offstage. :(
that was my next thought.....
how about:
trace(Event.COMPLETE);
[edit] package as3 { import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.Event;
public class StageExample extends Sprite {
public function StageExample() {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.ACTIVATE, activateHandler);
stage.addEventListener(Event.RESIZE, resizeHandler);
}
private function activateHandler(event:Event):void {
trace("activateHandler: " + event);
}
private function resizeHandler(event:Event):void {
trace("resizeHandler: " + event);
trace("stageWidth: " + stage.stageWidth + " stageHeight: " + stage.stageHeight);
trace(Event.COMPLETE);
}
}
}
ok, I played with it a bit and it does trace the Event.COMPLETE value as 'complete'. Does that help you?
[edit] NOPE, never mind!! It always reports as complete even with the mouse still down.
I'm sure a code genius will be along soon....... lol 
Interesting. I'll give it a shot. Myself, I kept getting an undefined for e.COMPLETE: private function init(e:Event):void{ removeEventListener(Event.ADDED_TO_STAGE, init); stage.addEventListener(Event.RESIZE, onResize); } private function onResize(e:Event = null):void{ // pause the video - works great, but we don't have a way to detect // when the resizing is done, thus no way to resume playback // _videos.pause(); if (e != null){ trace(e.COMPLETE); } }
I wasn't aware of Event.ACTIVATE. What exactly is that doing?
// edit: Ooooh... it's Event.COMPLETE, not the param. Ah.
// edit: Nah. Still won't work. Not sure how helpful Event.COMPLETE is - it's a constant. :(
yes it's Event not event, but it still doesn't work.
ACTIVATE is for when the movie loses it's focus, so you can stop the video on DEACTIVATE and play it again on ACTIVATE, but that doesn't work because ACTIVATE doesn't trigger after the resize even after clicking on the screen.
MOUSE_LEAVE also works close to DEACTIVATE.
Sorry I'm no help but I'm trying to figure something out. It seems stupid they wouldn't write something for RESIZE to report it is done AFTER the mouse is UP.
All I can think of now is an interval event that starts comparing the Stage w & h on RESIZE but only checks after 2 or 3 seconds. But, like I said, I am FAR from a code genius on this sort of stuff.
this is where I'm at.....
package as3 { import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.Event;
public class StageExample extends Sprite {
public function StageExample() {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.ACTIVATE, activateHandler);
stage.addEventListener(Event.DEACTIVATE, deactivateHandler);
stage.addEventListener(Event.RESIZE, resizeHandler);
stage.addEventListener(Event.TRYINGTOFIGUREOUTWHATGOESHERE, completeHandler);
}
private function activateHandler(event:Event):void {
// play the video when the movie has focus
trace("activateHandler: " + event);
}
private function deactivateHandler(event:Event):void {
// pause the video when the movie loses focus
trace("deactivateHandler: " + event);
}
private function resizeHandler(event:Event):void {
// pause the video
// you got this to work
trace("resizeHandler: " + event);
trace("stageWidth: " + stage.stageWidth + " stageHeight: " + stage.stageHeight);
}
private function completeHandler(event:Event):void {
// then play the video
trace("completeHandler: " + event);
}
}
}
perhaps you could set up a timer that monitors the size of the window and dispatches an event when a certain threshold isn't met.
pseudocode:
new timer(200) timer.start()
onTimer : if ( abs(oldW - w) < threshold && abs(oldH - h) < threshold ) dispatch STOPPED_RESIZING end
oldW = w;
oldH = h;
might be a hacky and not necessarily optimal way to do it, but it'll work.
cheers,
A.
Holy crap, Storm. Above and beyond the call... Thanks!
Yeah Lith, some sort of polling is probably the way to go. Not ideal, but cheaper than rendering the video.
Much appreciated, all!
I was done my project and "brainstorming" the next project so there was ample time to help a brutha out.