问题
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.
回答1:
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 \;
回答2:
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.
来源:https://stackoverflow.com/questions/3221311/how-do-i-recompile-flex-4-framework-rsls