Flex 4 App Blank
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!
If you are on mojos < 4 add this to your configuration of your 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>
...
and then create this file
<?xml version="1.0"?>
<flex-config>
<swf-version>11</swf-version>
</flex-config>
from: http://groups.google.com/group/flex-mojos/browse_thread/thread/143f69219fcddc16#
if you are on 4+ you can add this to your configuration
<configuration>
<configurationReport>true</configurationReport>
<sourceFile>Main.mxml</sourceFile>
<swfVersion>11</swfVersion>
...
from: http://groups.google.com/group/flex-mojos/browse_thread/thread/9ff3ea2e0e0461a4
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.
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.
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.
Try setting the width to 100 and the height to 25 in both cases.
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.
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
<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>
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.
精彩评论