2011-06-21 51 views
3

我正在构建一个Flex 4应用程序(使用flexmojos而不是FlexBuilder)。如果我创建一个测试应用程序如下,使用MX:应用程序,然后我看到一个按钮,我希望:Flex 4应用程序空白

<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:那么应用程序的所有我看到的是一个空白(白色)屏幕:

<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包装,我只是直接在浏览器中加载瑞士法郎。

这是我的聚甲醛...

<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> 

任何人知道我在做什么错? 感谢

UPDATE:

我现在已经储存在相同的位置.swf文件的所有RLSS为.swz文件,我已经设置了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加载甚至没有尝试过。

这是离奇的!

+0

您应该会收到错误消息。你甚至运行Flash Player调试? –

+0

这个问题有没有进展?我面临着同样的问题,flex 4.5.1 release + flexmojos 3.8(我必须用一个更新的flex-compiler-oem工件重新编译) – 2011-07-13 08:48:14

回答

0

我想这个问题是在RSL中,默认情况下应该加载,但是您没有正确定位它们。尝试列出所有必需的RSL并将其范围更改为merged。我认为thisthis链接将会有用。

+0

我认为你对RSL是正确的,但是我似乎无法得到它上班。你的第二个链接建议使用 rsl 缓存,但这些都不被Maven接受,它只是说:必须是[提供,编译,运行时,测试,系统]之一,但是'rsl'。 “合并”也一样。难道我做错了什么? – chris

+1

如果您发布POM,它会更好。 – Constantiner

+0

你说得对,做完了。 – chris

0

尝试在两种情况下将宽度设置为100并将高度设置为25。

+0

谢谢,但那不行 – chris

0

这不完全是一个答案,但更多的疑难解答信息可能有助于找到实际答案。我在IntellijIdea 10中使用swf构建swf的结果是相同的。我正在使用4.5 SDK。

有人建议我需要Flash Player 11,它与Adobe的孵化器。我在Flash Player 11中获得了相同的结果(使用spark时为白色屏幕,使用mx时为罚款)。

我在其他项目上使用FlexMojos,但为此,我只是用Flex 4.5进行一些概念验证测试,并且不想在构建方程中引入另一个变量,直到事情稳定。

希望这些额外的信息将帮助您找到问题的根本。

5

如果你是mojos < 4添加到您的配置的Flexmojos - Maven的插件

<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

1

使用ANT用的IntelliJ建设时,我有同样的问题随机。将目标Flash Player版本更改为10.2而不是10.3,可以解决问题。

0
  1. 首先,它被用作RSL,u需要提供范围的缓存 <scope>caching</scope>。你得到的警告很好,它是flex-mojos和maven的一个问题,我记得在flex-mojos-group的帖子中看到它。请自己搜索:)

  2. 检查文本布局版本,因为它总是带有不同的数字,比其他 框架rsls。即为文本布局你需要有一个单独的条目。参考this

      <rslUrls> 
           <url>{artifactId}_${flex.sdk.version}.{extension}</url> 
           <url>{artifactId}_${flex.textlayout.version}.{extension}</url><url>http://fpdownload.adobe.com/pub/{extension}/flex/${flex.sdk.version}/{artifactId}_${flex.sdk.version}.{extension}</url> 
    
  3. 在policyurls tag.see here条目的rslurls数量必须匹配条目数。所以policyFileUrls策略文件URL的数组。 rslUrls数组中的每个条目都必须在此数组中有相应的条目

  4. 使用firefox的firebug扩展,并观察网络控制台以查看它是否正在下载rsls。 U还可以使用net-export插件来保存netconsole日志并将其粘贴。

修改您的代码以执行上述检查并让我们知道结果。

1

我正面临与Flex Mojos 4.0和Flex 4.5相同的问题。当我升级到Flex Mojos 4.1-BETA时,问题得到了解决。