2011-06-21 54 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時,問題得到了解決。