Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 822
chris Avatar asked May 31 '26 13:05

chris


1 Answers

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

like image 99
SuperSaiyen Avatar answered Jun 03 '26 04:06

SuperSaiyen