3

I've made a runtime shared library for my project, let's call it ResourceLibrary. It contains all of the embedded assets for my project (images, sounds, movie clips) and it's used as a singleton in a lot of other bits of code.

I am compiling it using this batch (Windows unfortunately):

SET normalstuff=--namespace+=http://ns.adobe.com/mxml/2009,${flexlib}/mxml-2009-manifest.xml --namespace+=http://www.adobe.com/2006/mxml,${flexlib}/mxml-manifest.xml --namespace+=library://ns.adobe.com/flex/spark,${flexlib}/spark-manifest.xml -external-library-path lib -external-library-path+=${flexlib}/libs -external-library-path+=${flexlib}/libs/player/10.0
call compc -source-path src/ -output lib-ext/resources.swc -include-namespaces+=http://MYPROJECT -namespace+=http://MYPROJECT,confs/ResourceLibrary-manifest.xml %normalstuff% -library-path+=data/characters -library-path+=data/menus -library-path+=data/icons/relationships  -include-lookup-only=true 

That makes my resources.swc file, which, when I include this swc in my library and have -static-link-runtime-shared-libraries=true. But I want to not embed my runtime shared libraries in my main swf (cuts down the file size from 10mb to ~3mb), so static-link-runtime-shared-libraries must be false.

When I run my code, however, I get this error:

[Starting debug session with FDB]
[Fault] exception, information=VerifyError: Error #1014: Class mx.core::BitmapAsset could not be found.

I've been raking my brain over this probably super simple solution, but everywhere I look the answer everyone else gets is "static-link-runtime-shared-libraries to true".

Anyone have any clues/ideas on where to start?

Zambini
  • 43
  • 2
  • 5

3 Answers3

1

I figured this out but forgot to post here.

What you have to do is tell it where the swf to be used will be located, and what classes will be in it (the swc arg)

-runtime-shared-library-path=lib/MyLibrary.swc,MyLibrary.swf

I then extract the swc (using 7zip, but any works) and re-name the extracted swf to "MyLibrary.swf" and move it into the same directory as my main program.

Zambini
  • 43
  • 2
  • 5
  • Thank you! I've been having problems compiling Modules with MXMLC - the compiler wouldn't embed the ModuleBase class in those that needed it. In the end, the final solution came from ensuring that every Module was compiled with `-static-link-runtime-shared-libraries=true` and specifying each RSL and their path for each Module. – James Ford Feb 27 '12 at 10:07
0

If you're using a SDK that doesn't match the version of Flash Builder you're using, you may need to manually link to that SDK in the project properties.

Amy Blankenship
  • 6,485
  • 2
  • 22
  • 45
  • How do I check that? I'm using FlashDevelop 3.3.4 RTM and my Flex SDK is Flex SDK 4.1.0 In my Tools>Program Settings>AS3Context I have "Flex SDK Location" set to "C:\bin\Flex SDK 4.1.0" (which is where I installed it). Flex has always worked perfectly until this RSL stuff – Zambini Aug 08 '11 at 23:26
  • I'm not sure. I don't use FlashDevelop for Flex--it's simply not as nice a tool for Flex development, especially now with the productivity enhancements in FB 4.5. What I can say is that your library project needs to also link to the SDK. I think that your problem is likely that your main project knows about the correct SDK, but not the library project. Check your FD documentation on how to correct this. – Amy Blankenship Aug 09 '11 at 12:24
0

You do know that creating a swc is not an RSL, right? swc = compile time library. swf = runtime library (or swz if it's Adobe signed libs).

http://livedocs.adobe.com/flex/3/html/help.html?content=rsl_01.html#168690 http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_14.html

J_A_X
  • 12,857
  • 1
  • 25
  • 31
  • Yes, but I'm telling it the swc (to find what classes are going to be in the RSL) and the extracted swf (from the swc). at least that's what the AS3 docs tell me. – Zambini Aug 10 '11 at 04:15
  • [This tutorial](http://www.flexer.info/2008/01/08/how-to-create-a-swf-rsl-from-a-swc-and-how-to-use-it/) tells you how to create a custom RSL from a swc. From here, you need to specify the rsl-url (runtime-shared-libraries rsl-url in mxmlc) when creating your swf. – J_A_X Aug 10 '11 at 04:30