I created a Flex mxml project in Flex Builder and a library it needs to share with other projects. From Flex Builder, it builds and runs when linked either as static / "Merged into code" or as dynamic / "Runtime Shared Library", which is good.
Unfortunately, I need to build this from the command line. This worked before I added the library. Now when I try to link statically, mxlmc.exe complains about the library object in the mxml file being undefined. When I try to link dynamically the mxml builds into a swf, but when I run the swf it complains "". See below:
static = true
>mxmlc.exe Sample.mxml -static-link-runtime-shared-libraries=true -runtime-shared-library-path=shared.swc,library.swf
Loading configuration file C:\Program Files\Adobe\Flex Builder 3\sdks\3.0.0\frameworks\flex-config.xml
C:\...\Sample\swf\src\Sample.mxml(15): Error: Type was not found or was not a compile-time constant: Profile.
private var myProfile:Profile;
C:\...\Sample\swf\src\Sample.mxml(22): Error: Call to a possibly undefined method Profile.
myProfile = new Profile(...);
static = false
>mxmlc.exe Sample.mxml -static-link-runtime-shared-libraries=false -runtime-shared-library-path=shared.swc,library.swf
Loading configuration file C:\Program Files\Adobe\Flex Builder 3\sdks\3.0.0\fram
C:\...\Sample\swf\src\Sample.swf (70714 bytes)
SecurityError: Error #2148: SWF file file:///C|/.../Sample/swf/src/Sample.swf cannot access local resource file:///C|/.../SampleDevice/swf/src/library.swf. Only local-with-filesystem and trusted local SWF files may access local resources.
Ideally I would like to get both working. Second best option would be static linking, and dynamic linking would be third best.
Any chance it matters that I have not rebuilt the swc from the command line and am using the one built by Flex?
Finally got it to statically link using:
>mxmlc.exe Sample.mxml -include-libraries=shared.swc
Would still like to know how to get dynamic linking working.
The problem you have run into with dynamic linking is a security issue. See the "Using RSLs with the Flex SDK" section of this Flex Developer Center article, http://www.adobe.com/devnet/flex/articles/flash_player_cache_05.html. It will show you how to set up a Flash Player trust file.