How to use a runtime-shared library

Declaring a dependency as a shared library

To be able to use a dependency as a RSL, the dependency artifact should have been built using the makeRSL property. See Creating RSL artifacts for more about RSL generation.

To set a dependency as a RSL, you should add a runtimeSharedLibrary element to the rsls tag of the configuration section in the project POM. The mapping between the dependency and the matching RSL declaration is based on the groupId and artifactId values. Each runtimeSharedLibrary element may contain one or more runtimeSharedLibraryUrl nested tag, used to define where the Flash Player runtime should retrieve the library at runtime.

...
    <build>
        ...
        <plugins>
            ...
            <plugin>
                <groupId>org.servebox.flex</groupId>
                <artifactId>flex-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <rsls>
                        <runtimeSharedLibrary>
                            <groupId>com.adobe.flex.sdkcore</groupId>
                            <artifactId>framework</artifactId>
                            <urls>
                                <runtimeSharedLibraryUrl>
                                    <url>framework.swf</url>
                                </runtimeSharedLibraryUrl>
                            </urls>
                        </runtimeSharedLibrary>
                    </rsls>
                </configuration>
            </plugin>
        </plugins>
    </build>
    ...
    <dependencies>
        ...
        <dependency>
            <groupId>com.adobe.flex.sdkcore</groupId>
            <artifactId>framework</artifactId>
            <version>3.2.0.3958</version>
            <type>swc</type>
        </dependency>
        ...
    </dependencies>
...

Flash Player security and policy files

When a Flex application tries to load external resources, such as RSLs, the Flash Player runtime applies security restrictions, based on the domain of origin of these resources. Unlike standard RSLs, cross-domain RSLs may be loaded by applications that resides in different domains or sub-domains.

See Flash Player security overview for more about Flash Player security.

Using the plugin, URL indicating where to retrieve individual policy files can be added to the RSL declarations.

...
                    <rsls>
                        <runtimeSharedLibrary>
                            <groupId>com.adobe.flex.sdkcore</groupId>
                            <artifactId>framework</artifactId>
                            <urls>
                                <runtimeSharedLibraryUrl>
                                    <url>framework.swf</url>
                                    <policyFileUrl>http://myrsls.mydomain.com/rsl/rsls-policy.xml</policyFileUrl>
                                </runtimeSharedLibraryUrl>
                            </urls>
                        </runtimeSharedLibrary>
                    </rsls>
...

Signed and unsigned RSLs

Signed RSLs are libraries which are signed by Adobe. Signed RSLs can be loaded from any domain with no need for policy files, and can be stored into the Flash Player cache. Unsigned RSLs rely on the browser's cache to keep them from being downloaded.

Each signed RSL can be associated to a "failover" RSL, used whenever the Flash Player running the application is lower than version 9.0.60, or whenever the Flash Player is unable to download the signed RSL (due to a network failure for example).

...
                    <rsls>
                        <runtimeSharedLibrary>
                            <groupId>com.adobe.flex.sdkcore</groupId>
                            <artifactId>framework</artifactId>
                            <urls>
                                <runtimeSharedLibraryUrl>
                                    <url>http://myrsls.mydomain.com/rsl/framework.swz</url>
                                </runtimeSharedLibraryUrl>
                                <runtimeSharedLibraryUrl>
                                    <url>framework.swf</url>
                                    <policyFileUrl>http://myrsls.mydomain.com/rsl/rsls-policy.xml</policyFileUrl>
                                </runtimeSharedLibraryUrl>
                            </urls>
                        </runtimeSharedLibrary>
                    </rsls>
...

Flash Player 9.0.60 is required to load signed runtime-shared libraries.