我正在构建一个Flex4应用程序(使用flexmojos而不是FlexBuilder)。如果我使用mx:Application创建一个测试应用程序,如下所示,我会看到一个按钮:
<mx:Application
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="http://www.adobe.com/2006/mxml">
<s:Button
label="Button"/>
</mx:Application>但是,如果我使用s:Application,那么我看到的只是一个空白(白色)屏幕:
<s:Application
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="http://www.adobe.com/2006/mxml">
<s:Button
label="Button"/>
</s:Application>顺便说一句,我目前没有使用html包装器,我只是在浏览器中直接加载swf。
这是我的pom。
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.aaa.bbb</groupId>
<artifactId>app</artifactId>
<packaging>war</packaging>
<version>2.0-SNAPSHOT-1</version>
<name>app</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<sourceDirectory>src/main/flex</sourceDirectory>
<testSourceDirectory>src/test/flex</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<version>3.9</version>
<dependencies>
<dependency>
<groupId>com.adobe.flex</groupId>
<artifactId>compiler</artifactId>
<version>4.5.0.20967</version>
<type>pom</type>
</dependency>
</dependencies>
<extensions>true</extensions>
<configuration>
<policyFileUrls>
<url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</url>
</policyFileUrls>
<rslUrls>
<url>http://fpdownload.adobe.com/pub/{extension}/flex/4.5.0.20967/{artifactId}_{version}.{extension}</url>
</rslUrls>
</configuration>
<executions>
<execution>
<id>flex-compile</id>
<phase>compile</phase>
<goals>
<goal>compile-swf</goal>
</goals>
<configuration>
<output>src/main/webapp/Main.swf</output>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>textLayout</artifactId>
<version>4.5.0.20967</version>
<type>swc</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>framework</artifactId>
<version>4.5.0.20967</version>
<type>swc</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>spark</artifactId>
<version>4.5.0.20967</version>
<type>swc</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>sparkskins</artifactId>
<version>4.5.0.20967</version>
<type>swc</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>rpc</artifactId>
<version>4.5.0.20967</version>
<type>swc</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>datavisualization</artifactId>
<version>4.5.0.17855</version>
<type>swc</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>flex-framework</artifactId>
<version>4.5.0.20967</version>
<type>pom</type>
</dependency>
</dependencies>
</project>有人知道我做错了什么吗?谢谢
更新:
我现在已经将所有的RSL作为.swz文件存储在与.swf文件相同的位置,并且我已经将RSL设置如下:
<configuration>
<policyFileUrls>
<url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</url>
</policyFileUrls>
<rslUrls>
<url>{artifactId}_${flex.sdk.version}.{extension}</url>
<url>http://fpdownload.adobe.com/pub/{extension}/flex/${flex.sdk.version}/{artifactId}_${flex.sdk.version}.{extension}</url>
</rslUrls>
</configuration>尽管如此,这款应用仍然是一片空白。在使用FireBug时,我看不到任何关于RSL的请求,也没有任何与此相关的错误消息。似乎RSL加载甚至都没有尝试过。
这太奇怪了!
发布于 2011-07-18 21:10:08
如果您使用的是mojos <4,请将此代码添加到您的flexmojos-maven-plugin配置中
<configuration>
<configurationReport>true</configurationReport>
<sourceFile>Main.mxml</sourceFile>
<configFiles><!-- Fix for Mojos's < 4 -->
<configFile>flex-config-swf-version-11.xml</configFile>
</configFiles>
...然后创建这个文件
<?xml version="1.0"?>
<flex-config>
<swf-version>11</swf-version>
</flex-config> 来自:http://groups.google.com/group/flex-mojos/browse_thread/thread/143f69219fcddc16#
如果您使用的是4+,则可以将其添加到您的配置中
<configuration>
<configurationReport>true</configurationReport>
<sourceFile>Main.mxml</sourceFile>
<swfVersion>11</swfVersion>
...来自:http://groups.google.com/group/flex-mojos/browse_thread/thread/9ff3ea2e0e0461a4
发布于 2011-08-10 03:22:43
在使用ANT构建IntelliJ时,我随机遇到了同样的问题。将目标flash player版本更改为10.2,而不是10.3修复了该问题。
发布于 2011-12-14 12:23:30
我在Flex Mojos 4.0和Flex 4.5中也遇到了同样的问题。当我升级到Flex Mojos 4.1-BETA时,这个问题得到了解决。
https://stackoverflow.com/questions/6425213
复制相似问题