Flash does not receive resize event
In a div, we use swfobject to embed a flash player. We wrote the flash player in action script. During the initialization of the web page, we use javascript to resi开发者_开发技巧ze the div to make the player best fits the browser. The enclosed flash player registers an OnResize event listener and handler. The question is the OnResize event is not called when the enclosing div's resized. (The OnResize event does get called when we drag to resize the browser afterwards.) Could the be caused by the Flash VM is not fully ready when the div's being resized? what is the best way to make sure the OnResize event is called in this case?
Thanks.
To establish whether the events are firing in the order you expect, log them all to your JS console. Log the DIV resize from JS using console.log
with Firebug/Chrome Dev, and log the Flash event firing using an ExternalInterface wrapper around the same console.log
.
In Flash, onAddedToStage
will be fired when your Flash is ready. I usually manually fire onResize
in the onAddedToStage
handler, in case the window was resized before the Flash was ready. You can also have your JS resize handler defer firing onResize
on the Flash until after onAddedToStage
is fired if you ensure that onAddedToStage
is published to JS using ExternalInterface.
精彩评论