如何设置 RSL(运行时共享库​​)

发布于 2024-10-16 11:46:25 字数 1099 浏览 2 评论 0原文

堆叠

我在建立一个新项目(电子学习)时遇到了一些麻烦,我认为该项目将从 RSL 中受益匪浅。
我的案例是这样的:

Main.fla - A Shell
Scenes.fla - 我会在一分钟内解释这一点
Navigation.fla - 某种 GUI
很多 Fla 文件 - 课程

Main 将是第一部被实例化的电影,然后,这里所需的一切将是 <强>下载。

除了“架构”(即主、场景、导航和称为引擎的一整套类)之外,每节课都将放在 fla/swf 中,并且将在运行时添加到场景中。

引擎负责处理重复且必要的任务、事件、通用方法、与服务器的通信等。

导航负责处理用户输入,如导航(下一个/上一个课程等),然后将其传递给引擎,引擎将操纵场景(及其子场景)。

嗯,我也有一些限制:
每个将交给我们客户的 swf 文件都需要小于 80kb,这意味着我被束缚了。
我无法将整个内容编译为准备交付的包。

由于尺寸很重要,我需要尽可能减轻负载的方法。
所以,这几天我查了很多,找到了RSL。
我创建了一些测试来更好地了解如何使用它,当然,我陷入了陷阱。

我无法正确设置我的 Flash,“库路径”(在 AS3 配置下)没有取得任何成功,无法在 SWC 中编译类...

另一件事是我赢了不做课程,只做架构。
这些课程将由可能根本没有 AS3(OOP 或程序逻辑)知识的人创建。
而且我不倾向于将整个引擎(源代码)交付给可能会弄乱它的外部任何人,从而制作整个应用程序(应用程序,事实上,我们将制作数百个电子学习内容)。

我真的认为我在某些事情上需要帮助(时间在流逝):

如何有效地使用 RSL
如何在 SWC 中捆绑类
如何在 SWC 中打包整个工作所需的所有内容,然后仅交付此 SWC

我知道这个线程有点长,而且我问了很多事情,但我正在破解我的头靠在键盘上已经一周了,但无法管理设置。

感谢您的关注...
内莫斯坦

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半暖夏伤 2024-10-23 11:46:25

有两种方法可以从 fla 中执行此操作,

一种是导出整个库。
转到发布设置,选择“仅 Flash”,然后在“Flash”选项卡下选择“导出 SWC”

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

另一种方法是右键单击库中的项目并选择导出 SWC。如果您对具有大小限制的项目遇到问题,这可能是可行的方法,但否则我建议导出整个库将

链接 ID 添加到资产中非常重要
您可以通过库中的链接 ID 列或通过编辑符号属性来输入此信息。

这些 ID 必须是唯一的,因为这些是您将用来调用它们的类的名称。创建一个公共前缀是个好主意,这样它们就不太可能干扰其他类。

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

编译完资源后,您可以将它们添加到项目的运行时库文件夹中,也可以通过设置或嵌入标签将它们一一嵌入。我使用 FlashDevelop,这使它变得很容易,不确定您使用的是什么,但我确信该选项存在并且易于访问。


使用库。

我一直在做什么来加载资源(运行时的 swf)
为什么要运行-tim swfs?好吧,如果您要为内容编译引擎,那么您确实无法将引擎分开。这个想法是,首先加载引擎,然后加载告诉它如何处理库以及在哪里找到每个库的配置。

我的 setup/getup simplified 是这样的

我有一个默认的配置 xml 文件,其中添加了库。出于我的目的,我知道预期的库,因此我有带有预定义 id 的 xml 标签,如下所示:

在代码方面,我将库的名称/类型定义为静态常量,并将它们全部放入另一个常量(即数组)中。
我的数据类中有类似的东西
const static var TYPE_COMPONENTS:String = "组件";
const static var TYPE_INTERFACE:String = "接口";
const static var TYPES:Array = [TYPE_COMPONENTS,TYPE_INTERFACE];

一旦我加载了 confg xml,就可以一一浏览子节点,看看它们是否与我的 TYPES 数组下的任何项目匹配。我将所有匹配项放入组加载器中(http://as3.casalib.org/docs/ org_casalib_load_GroupLoad.html)我还将所有资源放入字典数组中,以便我可以通过我定义的静态变量(Data.TYPE_INTERFACE)进行资产

然后等待加载完成。

加载资源后,我使用 getLoader(Data.TYPE_INTERFACE)。getDefinition (myClassName) 创建

它有助于拥有 的类hasDefinition 检查类是否存在而不抛出错误。

您需要知道类名是什么才能调用它,我使用另一个 XML 文件来定义要查找的类以及如何处理它们。

我手动生成 XML 文件,有时需要提醒自己有哪些选项,但可以创建一个可以生成这些文件的 AIR 应用程序。因为我使用 swf 作为在 PC 上运行的引擎,所以无法像使用服务器端技术或 AIR 那样找到子文件夹中存在的库,因此 XML 是必需的。

希望这有帮助

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文