3

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!

chris
  • 1,731
  • 4
  • 26
  • 33
  • You should be getting an error. Are you even running flash player debug? – J_A_X Jun 21 '11 at 22:20
  • Has there been any progress on this issue? I am facing the same issue, flex 4.5.1 release + flexmojos 3.8 (which I had to recompile with a newer flex-compiler-oem artifact) –  Jul 13 '11 at 08:48

7 Answers7

5

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

SuperSaiyen
  • 1,410
  • 10
  • 12
1

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.

1

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.

0

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.

Constantiner
  • 14,231
  • 4
  • 27
  • 34
  • I think you are right about the RSLs, however I can't seem to get it to work. Your second link suggests using rsl or caching, yet neither of those are accepted by Maven which just says: must be one of [provided, compile, runtime, test, system] but is 'rsl'. Same goes for "merged". Am I doing something wrong? – chris Jun 21 '11 at 14:11
  • 1
    It will be much more better if you post your POM. – Constantiner Jun 21 '11 at 14:15
  • Incidentally, I am running this within an execution block for a specific reason (even though that might not be the standard way) – chris Jun 21 '11 at 14:38
  • Do you know what the URL for the RSLs is? I am behind a proxy, so maybe it is blocked, but I don't know what it is so I can't test that. – chris Jun 21 '11 at 15:23
  • It seems as though the scope error message is a bit of a red herring ,just a warning from Maven, and in theory it should work. No joy though – chris Jun 21 '11 at 15:49
0

Try setting the width to 100 and the height to 25 in both cases.

Black Dynamite
  • 4,067
  • 5
  • 40
  • 75
0

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.

TroyJ
  • 1,620
  • 1
  • 10
  • 7
0
  1. 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 :)

  2. 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>
    
  3. 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

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

JWhiz
  • 681
  • 3
  • 10
  • 22