Montag, 26. September 2011

Installing created air packages fails

In case anybody might come across this issue:

I use to have my workspace on a remote network folder and created the exported air package there (Flex 4.5, Air 2.6). When doubleclicking to install the air package when it is still located in the remote folder the installation will fail saying the package is corrupt or damaged.

unfortunately I only got the german error:
"Die Anwendung konnte nicht installiert werden, da die Installationsdatei beschädigt ist. Bitten Sie den Anwendungsautor um eine neue Installationsdatei."

solution:
copy the file to your desktop and you're good to go.

Dienstag, 15. Februar 2011

Resizing Dynamically Loaded swfs using swfloader (Flex 4)

I needed to update some code from



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.