Hello,

I am trying to build an AIR application using Maven 2.0.9, Flexmojos
3.9, JDK 1.5, Flex framework 3.5 and AIR runtime 2.5.

A specific part of the code is causing me a problem. Here it is:

                    var result:someDto = event.result as someDto
                    var fileData:ByteArray = result.content as
ByteArray;
                    var file:File =
File.documentsDirectory.resolvePath(result.filename);
                    var stream:FileStream = new FileStream();
                    stream.open(file, FileMode.WRITE);
                    stream.writeBytes(fileData, 0, fileData.length);
                    stream.close();

                    try {
                        file.openWithDefaultApplication();
                    }
                    catch(e:ReferenceError) {
                        Alert.show("error: " + e);
                    }

file.openWithDefaultApplication() only exists in AIR 2.0 and above,
not in Flex framework. I get the following error all the time:

error: ReferenceError: Error #1069

Which I guess means that the AIr application cannot find the
file.openWithDefaultApplication() function.

My POM looks like the following:

        <properties>
                <flexmojos.version>3.9</flexmojos.version>
                <flex.sdk.version>3.5.a.12683</flex.sdk.version>
                <air.sdk.version>4.5.0.19786</air.sdk.version>
                
<keystore.file>${basedir}/src/main/resources/key.p12</keystore.file>
                <keystore.password>xxx</keystore.password>
        </properties>
        <build>
                <finalName>${project.parent.artifactId}-${project.version}-$
{profile.id}</finalName>
                <sourceDirectory>${basedir}/src/main/flex</sourceDirectory>
                <plugins>
                        <plugin>
                                <groupId>org.sonatype.flexmojos</groupId>
                                <artifactId>flexmojos-maven-plugin</artifactId>
                                <version>${flexmojos.version}</version>
                                <extensions>true</extensions>
                                <executions>
                                        <execution>
                                                <goals>
                                                        <goal>sign-air</goal>
                                                </goals>
                                        </execution>
                                </executions>
                                <dependencies>
                                        <dependency>
                                                
<groupId>com.adobe.flex</groupId>
                                                
<artifactId>compiler</artifactId>
                                                
<version>${flex.sdk.version}</version>
                                                <type>pom</type>
                                                <exclusions>
                                                        <exclusion>
                                                                
<groupId>com.adobe.flex.compiler</groupId>
                                                                
<artifactId>adt</artifactId>
                                                        </exclusion>
                                                </exclusions>
                                        </dependency>
                                        <dependency>
                                                
<groupId>com.adobe.flex.compiler</groupId>
                                                <artifactId>adt</artifactId>
                                                
<version>${air.sdk.version}</version>
                                        </dependency>
                                </dependencies>
                                <configuration>
                                        
<flexBuilderCompatibility>true</flexBuilderCompatibility>

                                        <sourceFile>myapp.mxml</sourceFile>
                                        
<descriptorTemplate>${basedir}/src/main/resources/myapp.xml</
descriptorTemplate>

                                        <keystore>${keystore.file}</keystore>
                                        
<storepass>${keystore.password}</storepass>
                                        <timestampURL>none</timestampURL>

                                </configuration>
                        </plugin>
                </plugins>
        </build>

        <dependencies>
                <dependency>
                        <groupId>com.adobe.flex.framework</groupId>
                        <artifactId>flex-framework</artifactId>
                        <version>${flex.sdk.version}</version>
                        <type>pom</type>
                        <exclusions>
                                <exclusion>
                                        
<groupId>com.adobe.flex.framework</groupId>
                                        <artifactId>playerglobal</artifactId>
                                </exclusion>
                        </exclusions>
                </dependency>
                <dependency>
                        <groupId>com.adobe.flex.framework</groupId>
                        <artifactId>air-framework</artifactId>
                        <version>${air.sdk.version}</version>
                        <type>pom</type>
                        <exclusions>
                                <exclusion>
                                        
<groupId>com.adobe.flex.framework</groupId>
                                        
<artifactId>common-framework</artifactId>
                                </exclusion>
                                <exclusion>
                                        
<groupId>com.adobe.flex.framework</groupId>
                                        <artifactId>airframework</artifactId>
                                </exclusion>
                                <exclusion>
                                        
<groupId>com.adobe.flex.framework</groupId>
                                        <artifactId>airspark</artifactId>
                                </exclusion>
                        </exclusions>
                </dependency>
                <dependency>
                        <groupId>com.adobe.flex.framework</groupId>
                        <artifactId>airframework</artifactId>
                        <version>${flex.sdk.version}</version>
                        <type>swc</type>
                </dependency>



The build trace is the following:

[INFO] [resources:resources]
[INFO] Using 'ISO-8859-15' encoding to copy filtered resources.
[INFO] Copying 145 resources
[INFO] [flexmojos:compile-swf]
[INFO] Flexmojos 3.9
[INFO]   Apache License - Version 2.0 (NO WARRANTY) - See COPYRIGHT
file
[WARNING] Target player not set, not sure how to behave on air
projects
[INFO] Flex compiler configurations:
-compiler.accessible=false
-compiler.actionscript-file-encoding UTF-8
-compiler.allow-source-path-overlap=false
-compiler.as3=true
-compiler.debug=false
-compiler.es=false
-compiler.external-library-path C:\ProgramData\.m2\repository\com\adobe
\flex\framework\airglobal\4.5.0.19786\null\airglobal.swc
-compiler.fonts.local-fonts-snapshot C:\workspace\myapp\target\classes
\fonts.ser
-compiler.fonts.managers flash.fonts.JREFontManager
flash.fonts.AFEFontManager flash.fonts.BatikFontManager
-compiler.headless-server=false
-compiler.include-libraries=
-compiler.keep-all-type-selectors=false
-compiler.keep-generated-actionscript=false
-compiler.library-path C:\ProgramData\.m2\repository\com\adobe\flex
\framework\flex\3.5.a.12683\flex-3.5.a.12683.swc C:\ProgramData
\.m2\repository\com\
adobe\flex\framework\framework\3.5.a.12683\framework-3.5.a.12683.swc C:
\ProgramData\.m2\repository\com\adobe\flex\framework\rpc\3.5.a.
12683\rpc-3.5.a.
12683.swc C:\ProgramData\.m2\repository\com\adobe\flex\framework
\utilities\3.5.a.12683\utilities-3.5.a.12683.swc C:\ProgramData
\.m2\repository\com\ado
be\flex\framework\aircore\4.5.0.19786\aircore-4.5.0.19786.swc C:
\ProgramData\.m2\repository\com\adobe\flex\framework\applicationupdater
\4.5.0.19786\ap
plicationupdater-4.5.0.19786.swc C:\ProgramData\.m2\repository\com
\adobe\flex\framework\applicationupdater_ui
\4.5.0.19786\applicationupdater_ui-4.5.0.
19786.swc C:\ProgramData\.m2\repository\com\adobe\flex\framework
\servicemonitor\4.5.0.19786\servicemonitor-4.5.0.19786.swc C:
\ProgramData\.m2\reposito
ry\com\adobe\flex\framework\airframework\3.5.a.
12683\airframework-3.5.a.12683.swc C:\ProgramData\.m2\repository\com
\adobe\flex\framework\datavisualiza
tion\3.6.0.16995\datavisualization-3.6.0.16995.swc C:\ProgramData
\.m2\repository\org\swizframework\swiz\0.6.2\swiz-0.6.2.swc C:
\ProgramData\.m2\reposi
tory\org\bytearray\alivePDF\0.1\alivePDF-0.1.swc C:\ProgramData
\.m2\repository\fr\common\flex\flexlib\0.1\flexlib-0.1.swc C:
\ProgramData\.m2\repositor
y\fr\common\flex\flexmdi\0.1\flexmdi-0.1.swc C:\ProgramData
\.m2\repository\fr\common\flex\advancedAutoComplete
\1.0\advancedAutoComplete-1.0.swc C:\Pro
gramData\.m2\repository\fr\common\flex\autoComplete
\0.1\autoComplete-0.1.swc C:\ProgramData\.m2\repository\fr\common\flex
\greensock\0.1\greensock-0.1.
swc C:\ProgramData\.m2\repository\fr\common\flex\degrafa
\2.21\degrafa-2.21.swc C:\ProgramData\.m2\repository\com\adobe\flex
\framework\framework\3.5.a.
12683\framework-3.5.a.12683-en_US.rb.swc C:\ProgramData\.m2\repository
\com\adobe\flex\framework\rpc\3.5.a.12683\rpc-3.5.a.12683-en_US.rb.swc
C:\Progra
mData\.m2\repository\com\adobe\flex\framework\datavisualization
\3.6.0.16995\datavisualization-3.6.0.16995-en_US.rb.swc
-compiler.locale en_US
-compiler.namespaces.namespace http://www.adobe.com/2006/mxml C:
\workspace\myapp\target\classes\config-3.5.a.12683\mxml-manifest.xml

-compiler.optimize=true
-compiler.show-binding-warnings=false
-compiler.source-path C:\workspace\myapp\src\main\flex
-compiler.strict=true
-compiler.use-resource-bundle-metadata=true
-compiler.verbose-stacktraces=false
-compiler.warn-bad-null-assignment=false
-compiler.warn-duplicate-argument-names=false
-compiler.warn-duplicate-variable-def=false
-compiler.warn-no-constructor=false
-compiler.warn-no-type-decl=false
-default-background-color 8821927
-default-frame-rate 24
-default-script-limits 1000 60
-default-size 500 375
-licenses.license flexbuilder3 137740062638469719590590
-licenses.license flexbuilder3.displayedFirstLaunchMessage true
-licenses.license flexbuilder3.displayedStartPageAtLeastOneTime true
-metadata.date Fri Dec 30 18:19:55 CET 2011
-metadata.localized-title myapp x-default
-use-network=true
-verify-digests=true -static-link-runtime-shared-libraries=false -load-
config=
-metadata.language+=en_US
[debug] execute contextualize
[INFO] [resources:testResources]
[INFO] Using 'ISO-8859-15' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\workspace\myapp\src\test
\resources
[INFO] [flexmojos:test-compile]
[INFO] Flexmojos 3.9
[INFO]   Apache License - Version 2.0 (NO WARRANTY) - See COPYRIGHT
file
[WARNING] Test folder not foundC:\workspace\myapp\src\test\java
[INFO] [flexmojos:test-run]
[INFO] Flexmojos 3.9
[INFO]   Apache License - Version 2.0 (NO WARRANTY) - See COPYRIGHT
file
[INFO] Skipping test phase.
[WARNING] The parameter expression: 'project.build.resources' used in
mojo: 'sign-air' has been deprecated. Use 'project.resources' instead.
[INFO] [flexmojos:sign-air {execution: default}]
[INFO] Flexmojos 3.9
[INFO]   Apache License - Version 2.0 (NO WARRANTY) - See COPYRIGHT
file
[INFO]   completed 0 of 100
[INFO]   completed 100 of 100
[INFO]   AIR package created: C:\workspace\myapp.air
[INFO] [install:install]
(...)
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 4 minutes 55 seconds


The build produces the following details (for what seems to me the
most interesting):
- a file called C:\workspace\myapp\target\classes\air-config.xml with
the parameter <target-player>10</target-player> (what about this
warning during the build that 'Target player not set' then?)
- a file called C:\workspace\myapp\target\classes\flex-config.xml with
the parameter <target-player>9.0.124</target-player>
- a file called C:\workspace\myapp\target\classes\myapp.xml with a tag
<application xmlns="http://ns.adobe.com/air/application/2.5";>


After a look for solutions on the Web, I updated
the .actionScriptProperties file located on the root of my project to
set htmlPlayerVersion from "9.0.124" to "10.0.0" but it does not seem
to be considered by Flexmojos.


Switching to JDK 6 is not an option for now in this environment. Could
someone hint me in the right direction?

-- 
You received this message because you are subscribed to the Google
Groups "Flex Mojos" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/flex-mojos

http://flexmojos.sonatype.org/

Reply via email to