http://blogs.adobe.com/cantrell/archives/2010/03/extending_air_applications_with_plugins.html
- BoxDivider
- SomeSideBarContainer
// Main.as (skin = MainSkin.mxml) // viewStack, navigatorContent and loader initialization viewStack.addEventListener(ResizeEvent.RESIZE,function (e:ResizeEvent):void { if(loader.content == null || SystemManager(loader.content).application == null) return; navigatorContent.width = e.target.width; navigatorContent.height = e.target.height; (SystemManager(loader.content).application as Application).contentGroup.width = navigatorContent.width; (SystemManager(loader.content).application as Application).contentGroup.height = navigatorContent.height; }); navigatorContent.addElement(loader); loader.percentWidth = 100; loader.percentHeight = 100; loader.load(); viewStack.addElement(navigatorContent);
The advantage of this variant is that there is no need for a custom function "updateDimensions" in the loaded plugin application as all spark Applications have a contentGroup that can be resized (which also resized my main application).
Disadvantage or the dirty thing here is that the stage size of the loaded plugin stays the same as the main application's, just the content is resized to the visible part.
Interesting take on loading it. I'm not a fan of anonymous functions, especially when debugging. How does it resize? Is it choppy or do you get smooth resizing?
AntwortenLöschen