简体   繁体   中英

How to set up RSL (Runtime Shared Library)

Stack !

I'm having a little trouble setting up a new project (an e-Learning) that I think will benefit a lot from RSL.
My case is something like this:

Main.fla - A Shell
Scenes.fla - I'll explain this in a minute
Navigation.fla - Some kind of GUI
Lots Of Fla Files - The Lessons

The Main will be the first movie to be instantiated, then, all that is necessary from here will be download .

Every lesson will be put in a fla/swf apart from the " Architecture " (that is the Main, Scenes, Navigation and a whole bundle of classes called Engine ) and will be added at runtime inside the Scenes.

The Engine is responsible for handling repetitive and necessary tasks, events, common methods, communication with server, among other things.

The Navigation is responsible for handling user input, as the navigation (next/prev lesson and such), and then passes it to the Engine, that will manipulate the Scenes (and it's children).

Well, I have some restrictions too:
Every swf file that will be handed to our client need to have less than 80kb, which means I'm tied.
I can't compile the whole thing as a package ready to delivery.

As size counts, I need means to alleviate the load as much as possible.
So, I searched a lot these days and found out RSL.
I've created some tests to know better how to use this and, of course, got into a trap.

I haven't been able to set up my Flash correct, haven't any success with the "Library Path" (under AS3 configuration), haven't been able to compile classes inside the SWC...

Another thing is that I won't make the lessons, only the Architecture.
Those lessons will be created by people that may not have any knowledge in AS3 (OOP or program logic) at all.
And I'm not inclined to delivery the whole engine (source code) to anyone from outside that may mess with it, making the whole app (apps, in fact, we'll produce hundreds of e-learnings).

I really think I need help in some things (the clock is ticking away):

How to use RSL efficiently
How to bundle classes inside the SWC
How to package all that is imperative for the whole thing work in the SWC, and then, delivery only this SWC

I know that this thread is a little bit long, and that I'm asking a lot of things, but I'm cracking my head against the keyboard for a week now, and haven't been able to manage the set up.

Thank for your attention...
NemoStein

There are two ways to do this from an fla

one is exporting the entire library. Go to your publish settings select Flash only and then select Export SWC under the Flash Tab

http://img593.imageshack.us/img593/8296/swc.png

the other is to right click on an item in your library and select Export SWC. If you are having issues with items having a size restriction, this might be the way to go, but otherwise I'd recommend exporting the entire library

It is important that you add linkage ids to your assets You can enter this through the linkage id column in your library or by editing the symbol properties.

These IDs need to be unique, as these are the Classes' names you will call them by. It is a good idea to create a common prefix, so they're unlikely to interfere with other classes.

http://img827.imageshack.us/img827/7820/linkageid.png

When you have your assets compiled, you can either add them to your project's runtime library folder or embed them one-by-one through settings or the embed tag. I use FlashDevelop which makes it easy, not sure what you are using, butI'm sure the option is there and easily accessible.


Using Libraries.

What I've been doing for loading assets (swf at runtime) Why run-tim swfs ? Well, you really cannot keep the engine separate if you are compiling it for the content. The idea is that the engine is loaded first, and then loads the configuration that tells it how to handle libraries and where to find each one.

my setup/getup simplified is something like this

I have a default configuration xml file that where libraries are added. For my purposes, I know the expected libraries so I have xml tags with predifined ids like this:

on the code side I would define the names/types of libraries as a constant static and put all of them in another constant that's an array. Something like this in my Data class const static var TYPE_COMPONENTS:String = "components"; const static var TYPE_INTERFACE:String = "interface"; const static var TYPES:Array = [TYPE_COMPONENTS,TYPE_INTERFACE];

once I get the confg xml loaded, and can go through the child nodes one by one and see if they match any items under my TYPES array. I put all the matches in a group loader ( http://as3.casalib.org/docs/org_casalib_load_GroupLoad.html ) I also put all the resources into a dictionary array, so that I can assets by the static vars' I defined (Data.TYPE_INTERFACE)

Then I wait for the loading to finish.

Once it comes to loading the assets, I use getLoader(Data.TYPE_INTERFACE). getDefinition ( myClassName ) to create the class

it helps to have hasDefinition to check if the class exsits without throwing an error

You need to know what the class name is to call it, I use another XML file that defines what classes to look for and how to treat them.

I generate the XML files by hand and sometimes need to remind myself what the options are, but it would be possible to create an AIR app that could generate these files. Because I'm using an swf as an engine running on a pc, there is no way of finding what the libraries are present in a child folder, as you could with servers side technologies or AIR, so XML is a necessity.

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM