5. Code library and Runtime Shared Library (RSL) sample.
Download the project, unzip and open each project in FlashDevelop.
This sample project shows how to use the loader and library templates.
This technique allows to circumvent the difficulty to split a project into several SWFs:
- the classes must be included only in the library SWF,
- you want to attach a symbol from a loaded SWF into a parent SWF (which it is not possible using a simple loadMovie).
FlashDevelop can handle all the details for you:
- Code library: FD will generate intrinsic classes for the main SWF so the classes will only be included in the library SWF,
- RSL: using this technique, the main SWF will be able to attach symbols from the library SWF as if they were part of the main SWF.
This sample is composed of 3 projects:
1. The main project
Your application main SWF.
2. The library project
Created using the Library template:
- has your library code & assets,
- FD will generate intrinsic classes in the "include" directory,
- this "include" directory has to be added to the classpath of the main project.
- the generated SWF has to be added to the main project library (right-click: Add to Library) as a RSL (again right-click: Options.. and check: Load at runtime).
3. The preloader project
Created using the Custom Preloader template:
- it takes care of preloading the main SWF and the library SWFs (automatically),
- the generated SWF has to be added to the main project library (right-click: Add to Library) as the preloader (again right-click: Options.. and check: Add as preloader).
Deployment:
Be very careful when deploying the project online:
- the loader SWF doesn't need to be put online,
- the main SWF and library SWF must be put online with following the same relative path as when building the project:
/index.html
/TutProject.swf
/library/TutLibrary.swf
This is where it can get confusing:
/library/ is the path of the library SWF relative to the main project root directory when you built the main SWF.