views:

426

answers:

2

Does anyone know how to recompile Adobe Flex 4 framework RSLs?

I'm using the compiler directive -dump-config to get the build config file that the FlashBuilder IDE is using for compiling my application. I then pass that config file into the mxmlc compiler so I can build from the command-line. The results of the command-line build are output to a folder other than bin-debug. bin-debug is a localtrust path, and it will an application will run from there without error. A Flash application in any other path requires configuring the Flash Player to trust that path OR that the compile be done with the -use-network=false directive. I prefer latter since I'll be distributing the results to lay users for evaluation, and I don't want to request that they modify Flash Player security settings.

The build config file doesn't specify that framework RSLs be rebuilt using the -use-network false directive. FlashBuilder itself doesn't even compile framework RSLs. It merely copies RSL swfs from the framework directory into the bin-debug. Those swfs apparently were compiled by Adobe with the default -use-network=true.

So, I believe I need to recompile the RSLs. Of course any other tips on how to solve the problem are welcome.

A: 

In theory, you should be able to download all the code from the open source Flex SDK, create a SWC project, add the source code from the Flex framework and compile it that way. However, the benefit of using Adobe RSL is that the player can cache them. There is a chance that your end user will never request your server for the Flex Framework RSLs; having already cached them from some other site.

That said, I'm not sure I understand what the problem is. If you're distributing an application to your users via a web server, then those users can just surf it like any other application and test it that way. The folder used by Flash Builder, or your automated command line build script should have no relation to the user's ability to use the files.

Second, I compile all my applications to a directory named "bin" bypassing the default "bin-debug" directory suggested by Flex Builder. I've never had any trouble distributing applications for users to view. Or distributing code to other users due to this.

www.Flextras.com
I'm distributing the html wrapper, application swf, and rsl files. They are not being served by a server. I haven't had this problem until I started using Flex 4 SDK and FlashBuilder 4.
Michael Prescott
Well, that's not entirely true. I've seen similar Flash Player Security issues and typically handled them by changing from -use-network=true to false. Using flexTasks and a revised ant build file, I've improved things a bit. It merely warns now that textLayout_1.1.0.604.swf is internet-enabled, but it will run after the warning.
Michael Prescott
Distribute applications by giving people the HTML wrapper and generated SWFs seems odd to me. Maybe you should consider AIR or some other tool for desktop deployment. Additionally, you could also set the framework not to be an RSL so it's all embedded as one. I'm unclear what part of my answer is not entirely true.
www.Flextras.com
AIR would be overkill. I'm sending builds to sales, marketing, managers, and co-workers. I tried using -static-link-runtime-shared-libraries=true before asking about the rsls, but with that directive I can't even build. Compiler throws error "Unable to locate specified base class 'spark.components.Application' for component class 'Main'. Main.mxml." Thanks for responding. Your answer is entirely truthful, so I've upvoted it. It doesn't resolve my issue, so I'll leave it as unanswered for now. I'm studying Adobe's build file from opensource. I'll post the solution if I find one.
Michael Prescott
Why are you sending builds manually to these people instead of having them hit a web server--in the way that Flex / the Flash Player was designed for? It seems like you're introducing a deployment problem that using a web server would eliminate entirely.I would strongly suggest you consider a web server and having those folks hit the web server, or that you use an alternate technology better designed for desktop deployment. Since you already know Flex, AIR is an obvious choice as it will allow to easily update the local builds automatically as needed.
www.Flextras.com
Sometimes, emailing or copying a few files is just easier. There is no setup and if a sales person or whomever wants to review the application while offline it's right there. Just a simple dbl-click to launch.Anyhow, thanks for the conversation and all advice! I finally worked out a solution and posted the answer above.
Michael Prescott
A: 

Well, I learned more than I need to know about Flex RSLs, how to recompile the Flex SDK along with its unsigned RSLs, and that recompiling isn't necessary.

For the moment, I eliminated the flex config file from the build process and was able to focus on just the RSL issue. The order in which -runtime-shared-library-path's are listed is important because of class dependencies and order of process. Also, be sure to copy at least the unsigned RSLs into your output path. Otherwise, you'll see the following error: Error #2032: Stream Error. URL: file:///.../cmd-bin-debug/textLayout_1.1.0.604.swf

Finally, if you do need to use the flex config file dumped by FlashBuilder you'll need to transform it to prepend full paths to the RSLs. Also, watch for discrepancies between FlashBuilder project settings and what is dumped into the flex config. I found that I needed to tell FlashBuilder to clean the project more than once to get it to update the config file.

The distilled, working "recompile" is listed below. You'll need to replace or declare variables for FLEX_HOME and release_build

Specify signed RSL first and then the fail over, you must set -use-network=false to test locally otherwise the player will throw a Flash security error

mxmlc -use-network=false \
-runtime-shared-library-path=$FLEX_HOME/frameworks/libs/framework.swc,framework_$release_build.swz,,framework_$release_build.swf \
-runtime-shared-library-path+=$FLEX_HOME/frameworks/libs/textLayout.swc,textLayout_1.1.0.604.swz,,textLayout_1.1.0.604.swf \
-runtime-shared-library-path+=$FLEX_HOME/frameworks/libs/spark.swc,spark_$release_build.swz,,spark_$release_build.swf \
-debug=true $fullfile -output ../cmd-bin-debug/$filename.swf

Oh, and here's a convenient command to copy the RSLs to an output path: find $FLEX_HOME/frameworks/rsls ( -name '.swf' -o -name '.swz' ) -exec cp {} ../cmd-bin-debug \;

Michael Prescott