Flex 4 应用程序空白
我正在构建一个 Flex 4 应用程序(使用 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>
有人知道我做错了什么吗? 谢谢
更新:
我现在将所有 RLS 作为 .swz 文件存储在与 .swf 文件相同的位置,并且我将 RSL URL 设置如下:
<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。
这太奇怪了!
I'm building a Flex 4 app (using flexmojos rather than FlexBuilder). If I create a test Applications as follows, using mx:Application, then I see a button as I would expect:
<mx:Application
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="http://www.adobe.com/2006/mxml">
<s:Button
label="Button"/>
</mx:Application>
However, if I use s:Application then all I see is a blank (white) screen:
<s:Application
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="http://www.adobe.com/2006/mxml">
<s:Button
label="Button"/>
</s:Application>
Incidentally I am not currently using an html wrapper, I'm just loading the swf directly in the browser.
Here is my 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>
Anybody know what I am doing wrong?
Thanks
UPDATE:
I now have all the RLSs as .swz files stored in the same location as the .swf file, and I have the RSL URLs set as follows:
<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>
Still, the app is just blank. Using FireBug there don't seem to be any requests for any RSLs that I can see, neither are there any error messages pertaining to this. It seems as though the RSL loading is not even attempted.
This is bizarre!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
如果你在魔力< 4 将其添加到您的 flexmojos-maven-plugin 的配置中
,然后
从以下位置创建此文件: http ://groups.google.com/group/flex-mojos/browse_thread/thread/143f69219fcddc16#
(如果您已开启) 4+ 您可以将其添加到您的配置
中:http://groups.google.com/group /flex-mojos/browse_thread/thread/9ff3ea2e0e0461a4
If you are on mojos < 4 add this to your configuration of your flexmojos-maven-plugin
and then create this file
from: http://groups.google.com/group/flex-mojos/browse_thread/thread/143f69219fcddc16#
if you are on 4+ you can add this to your configuration
from: http://groups.google.com/group/flex-mojos/browse_thread/thread/9ff3ea2e0e0461a4
当使用 ANT 使用 IntelliJ 构建时,我随机遇到同样的问题。将目标 Flash 播放器版本更改为 10.2(而不是 10.3)解决了该问题。
I have the same problem randomly when building with IntelliJ using ANT. Changing the targeted flash player version to 10.2, rather than 10.3 fixed the problem.
我在使用 Flex Mojos 4.0 和 Flex 4.5 时也遇到了同样的问题。当我升级到 Flex Mojos 4.1-BETA 后,问题得到解决。
I was facing the same issue with Flex Mojos 4.0 and Flex 4.5. The problem got resolved when i upgraded to Flex Mojos 4.1-BETA.
我想问题出在 RSL 中,默认情况下应该加载它们,但您没有正确找到它们。尝试列出所有必需的 RSL 并将其范围更改为
合并
。我认为此 和此 链接将有用的。I suppose the problem is in RSLs which should be loaded by default but you haven't located them properly. Try to list all the required RSLs and change their scope to
merged
. I think this and this links will be useful.在这两种情况下尝试将宽度设置为 100,高度设置为 25。
Try setting the width to 100 and the height to 25 in both cases.
这并不完全是一个答案,而是更多可能有助于找到实际答案的故障排除信息。我在 IntellijIdea 10 中使用 make 构建 swf 时得到了相同的结果。我使用的是 4.5 SDK。
有人建议我需要 Flash Player 11,它位于 Adobe 的孵化器中。我在 Flash Player 11 中得到相同的结果(使用 Spark 时出现白屏,使用 mx 时则正常)。
我在其他项目中使用 FlexMojos,但为此我只是使用 Flex 4.5 进行一些概念验证测试,并且在事情稳定下来之前不想在构建方程中引入另一个变量。
希望这些附加信息能够帮助您找到问题的根源。
This is not exactly an answer, but more troubleshooting information that might help find the actual answer. I am having the same outcome building the swf with make in IntellijIdea 10. I am using the 4.5 SDK.
Somebody suggested that I needed flash player 11, which is in the incubator with Adobe. I get the same results in flash player 11 (white screen when using spark, fine when using mx).
I use FlexMojos on other projects, but for this I am just doing some proof-of-concept testing with Flex 4.5 and did not want to introduce another variable to the build equation until I had things stabilized.
Hopefully this additional information will help you get to the bottom of the problem.
首先,为了将其用作 rsl,您需要提供范围作为缓存
<范围>缓存
。你得到的警告很好,这是 flex-mojos 和 maven 的问题,我记得在 flex-mojos-group。请搜索 urself :)检查文本布局版本,因为它总是带有与其他版本不同的数字
框架 rsls。即对于文本布局,您需要有一个单独的条目。请参阅此
<前><代码>
{artifactId}_${flex.sdk.version}.{扩展名}
{artifactId}_${flex.textlayout.version}.{extension} http://fpdownload.adobe.com/pub/{extension}/flex/${flex .sdk.version}/{artifactId}_${flex.sdk.version}.{扩展名}
rslurls 中的条目数必须与policyurls 标签中的条目。参见 此处。所以policyFileUrls 策略文件URL 数组。 rslUrls 数组中的每个条目必须在此数组中具有相应的条目
使用 firefox 的 firebug 扩展,并观察 net 控制台以查看是否正在下载 rsls。您还可以使用net-export插件来保存netconsole日志并粘贴它。
修改您的代码以执行上述检查并告知结果。
First, for it to be used as rsl, u need to provide scope as caching
<scope>caching</scope>
. the warnings u get is just fine, and its a problem with flex-mojos and maven and i remember seeing it in a post in flex-mojos-group. pls search for urself :)check for the text layout version because it always comes with different number, than other
framework rsls. i.e for text layout u need to have a seperate entry. refer this
The number of entries in rslurls must match number of entries in policyurls tag.see here. so policyFileUrls array of policy file URLs. Each entry in the rslUrls array must have a corresponding entry in this array
Use firefox's firebug extension, and observe the net console to see whether it's downloading rsls. U can also use net-export plugin to save the netconsole logs and paste it.
modify your code to perform above checks and let know the results.