Caching framework!
Time to time I hear something about flex swf files size.
Seems Adobe hear that too. So, on Flex 3 Adobe starts a new initiative to resolve that, Framework Caching.
And how to use it on flex-mojos?
I quite complicated, but I will try to explain that.
To use as base I recommend this very complex hello world application.
The project structure like this:
Now, lets edit pom.xml.
First add the caching scope dependency:
<dependencies>
<dependency>
<groupId>com.adobe.flex.sdk</groupId>
<artifactId>framework</artifactId>
<version>3.0.0.3.0.0.477</version>
<type>swc</type>
<scope>caching</scope>
</dependency>
</dependencies>
This define to use flex framework on caching. But where the flash player must look for this files?
In order to define the RSLs location we need to do a second change on pom.xml:
<build>
<plugins>
<plugin>
<groupId>info.rvin.mojo</groupId>
<artifactId>flex-compiler-mojo</artifactId>
<configuration>
<rslUrls>
<rsl>{artifactId}-{version}.{extension}</rsl>
</rslUrls>
</configuration>
</plugin>
</plugins>
</build>
On rslUrls are defined the paths to look for RSLs.
Run mvn install and copy simple-flex-library-1.0-SNAPSHOT.swf and framework-3.0.0.3.0.0.477.swz to same directory on some web server to run.
Quite simple, isn’t it?
If you don’t wanna edit the pom, just download it from here.
Good caching for every one.
VELO
During compilation I am getting this:
[WARNING] A signed RSL was specified for library C:\japp\.m2\repository\com\adobe\flex\sdk\framework\3.2.0.3958\framework-3.2.0.3958.swc without an unsigned RSL as a failover. To avoid runtime errors, either require player version 9.0.115 in your HTML wrapper or add an unsigned RSL as a failover for the signed RSL. Use -target-player=9.0.115 if you choose to require player version 9.0.115.
How can I specify unsigned RSL in case of SWZ failure (lFlash player doesn’t support caching) ?
That is something I’m not sure, does flex allow you to specify BOTH?
If yes, flex-mojos doesn’t support that. And will be complicated, very complicated to support it.
Now, if you wanna change from caching to RSL, just change the scope from caching to rsl
VELO
What’s the difference between caching and RSL? I am getting compiler error when using 3rd party libraries as RSL (ex: Mate). I try setting verfiydigest to false and still get the errors. Any idea?
tks.
[ERROR] No signed digest found in catalog.xml of the library, C:\Documents and S
ettings\kwong\.m2\repository\Mate\Mate.8.5\Mate-0.8.5.swc. Compile the library
with -create-digest=true and try again.
[ERROR] No signed digest found in catalog.xml of the library, C:\Documents and S
ettings\kwong\.m2\repository\renaun\Logger\1.0.1\Logger-1.0.1.swc. Compile the l
ibrary with -create-digest=true and try again.
[ERROR] No signed digest found in catalog.xml of the library, C:\Documents and S
ettings\kwong\.m2\repository\FlexSpy\FlexSpy\1.2\FlexSpy-1.2.swc. Compile the li
brary with -create-digest=true and try again.
[ERROR] No signed digest found in catalog.xml of the library, C:\Documents and S
ettings\kwong\.m2\repository\com\allurent\urlkit\urlkitFlex3.9.2\urlkitFlex3-0
.9.2.swc. Compile the library with -create-digest=true and try again.
Well, in fact no idea. But I’m sure this work. I use that to cache framework.swc.
RSL and CACHING are very similar. CACHING is a signed RSL. Only Adobe can sign RSLs at present time.
Did you use the right option?
http://docs.flex-mojos.info/flex-compiler-mojo/compile-swf-mojo.html#verifyDigests
But this is a workaround. I suggest you using adobe tools (optimizer and compute digest) to get your RSLs signed.
VELO
I double-check and I am sure the verifyDigests option is correct. Here it is:
…
{artifactId}-{version}.{extension}
false
I also try using for the scope for Mate and the other third party dependencies, and it build, but at runtime it complains about classes not found, all from those 3rd party libaries.
VerifyError: Error #1014: Class com.asfusion.mate.core::LocalEventMap could not be found.
I know it is finding ths rsl swfs because if I remove those swfs from the webapp, it would complain about not finding them.
What am I missing?
tks.
Well, flex-compiler doesn’t handle the RSL order, but at runtime they must be loaded in order.
Example, you use RPC and FRAMEWORK as RSL (or CACHING make no difference).
If RPC is add first, you will get error at runtime. The FRAMEWORK must goes first, then RPC.
Try to load only one RSL, then another, then another, and so go on. If still with problems, ping me at google group, ok?
http://groups.google.com/group/flex-mojos
VELO
You are right. It is an ordering issue. I had the Flex framework and RPC stuff AFTER my 3rd parties libraries dependencies. After I switch it so that framework and RPC is 1st and 2nd in the dependencies list, everything works!
Thanks!