When I run my air application (compiled via flexmojos), it seems "empty"--there is no window at all. It works perfectly when compiled from Flash Builder.
I am compiling an Adobe Air Application using Maven's flexmojos plugin on Mac OS X: Lion. It successfully produces a SWF file and an AIR file.
When I double-click the SWF file, it opens just fine
(and crashes with an error you'd expect--since it's not running in the AIR environment)
When I double-click the AIR file, no window opens!
(I see my application name in the Mac menu bar but no application window and no errors)
When I look under /Applications/MyApplication.app/Contents/Resources
I see the following files:
META-INF MyAppMainAir.swf
MyAppMainAir.css mimetype
The swf file has the proper size and opens, as expected.
POM snippet
<plugin>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<version>${flexmojos.version}</version>
<configuration>
<flexBuilderCompatibility>true</flexBuilderCompatibility>
<sourceFile>${application.name}.mxml</sourceFile>
<finalName>${application.name}</finalName>
<descriptorTemplate>${project.build.sourceDirectory}/${application.name}-app.xml</descriptorTemplate>
<storepass>${keystore.password}</storepass>
<includeStylesheets>
<stlyesheet>
<name>${application.name}.css</name>
<path>${application.name}.css</path>
</stlyesheet>
</includeStylesheets>
<licenses>
<flexbuilder3>${flex.license}</flexbuilder3>
</licenses>
<targetPlayer>10.2.0</targetPlayer>
</configuration>
<executions>
<execution>
<goals>
<goal>sign-air</goal>
</goals>
</execution>
</executions>
</plugin>
Why is my SWF file being created properly but my AIR application won't open a window? When I build/run the application from Flash Builder, it works perfectly.
Any input/advice is appreciated!
After investigating this in the FlexMojos Google group, it turns out, I needed to set the following option:
<swfVersion>11</swfVersion>
For some reason, this was defaulting to 10, which caused the problem. Add this line, everything works perfectly!
Alternatively, I was also able to fix the problem by loading the air-config.xml file:
<loadConfig>${flex.sdk}/frameworks/air-config.xml</loadConfig>
This file can also be found in the repository:
${path_to_m2_repo}/com/adobe/flex/framework/framework/${flex.sdk.version}/configs_zip/air-config.xml
where flex.sdk.version=4.5.1.21328
, for example.
Also for the intial window to appear, you may need to adjust the descriptor values, setting visible=true:
<initialWindow>
<content>Main.swf</content>
<autoOrients>false</autoOrients>
<fullScreen>false</fullScreen>
<visible>true</visible>
</initialWindow>
The error I was having, combined with this set to false caused the window not appear, at all, which was confusing. After setting visible=true, the window would at least show up but all spark contents were missing. Once the error was fixed, I could set visible back to false.