Loading an external SWF App in a new Air window with resize functionality
i'm trying to load a local SWF Application in my Air Application via the SWFLoader class. The SWFLoader
class is displayed in a new Window
. Therefore, i'm trying to resize the window automatically, when the Flash Application is resizing. But here's the problem. The SWFLoader does not get any events when the loader App has been resized.
The Problem seems to be the Sandbox Restrictions. I'm able to call methods in the childSandboxBridge
and parentSandboxBridge
Objects that i've set in the LoaderInfo
of the SWFLoaders content (the loaded SWF Application). But i cannot listen to any ResizeEvents or something like that when i'm resizing the loaded App.
I'm aw开发者_C百科are of the workaround with the Loader
Class and the codeExecution Property, but i don't want to bypass the Air Sandbox - if possible.
Can anyone help me with this?
Thanks in advance
(Note: other security sandbox issues may be part of your problems. That said...) IF your sandboxBridge is set and you can call methods though it as you mentioned, then you can dispatch and listen for events that bubble up through the swfLoader (and they do bubble through).
As a test I would try dispatching a test flash.events.Event with bubbles=true when your loaded swf captures its internal resizeEvent. (ResizeEvents, by default, do not bubble and could be the source of your issue).
I find this way, putting it in childSwf:
addEventListener(Event.ADDED,added)
function added(e){
if (root.parent.parent){
root.parent.parent.stage.addEventListener(Event.RESIZE, mainResizeHandler);
}
function mainResizeHandler(e:Event = null):void{
trace("width: "+stage.stageWidth+" | height"+stage.stageHeight);
}
精彩评论