ActionScript 3.0 :: Runtime Shared Library Store Classes?
Sep 19, 2009
working a project that has 9 swf.a lot of the swf are using the same classes like papervison and tweenlite.is there a way to store classes like papervison in a share library?
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[code]...
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).
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'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.
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).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
Kindly note I am not asking what SWCs are used for, I know about that. I want to know, the use of RSLs in flash. Say i have some useful classes which i currently am using by specifying the particular folder as an "Additional source folder". So, can i make use of RSL here. If not, when and why i need to use RSLs ( I use SWCs without any problem, but i wanna know how to make use of RSL, without making SWCs, ie just by bunch of actionscript classes )
I am facing an error using shared libraries. The error pops up during compile and only happen when I give an instance name to my imported asset. Let me describe further:
I have an asset library where all movie clips in this file are exported for runtime sharing - LibraryA.swf
Next is the file that uses the assets - ShirtA.swf
What I did is to import an asset from LibraryA.swf (e.g. collar) into ShirtA.swf. Now I have collar movieclip in my ShirtA library. I drag an instance of it to the stage and compile. No problems.
I then gave this instance a name, "myCollar". I tried to compile again, and I get an error from Flash IDE - 1046: Type was not found or was not a compile-time constant: collar
I just finished up my site, and this is the only thing holding me back from publishing it. Whenever I "Test" my site, I get this error: " Your content will not stream. Runtime Shared Library (RSL) preloading will require all of your content to download before the first frame will play.
To prevent this you can change the Runtime Shared Library Library Settings, in the Advanced ActionScript 3.0 Settings dialog which can be raised from the Publish Settings dialog.The Runtime Shared Libraries being preloaded are:
textlayout_1.0.0.595.swz for TLF Text"
Does anyone know how to correct this error? If you do, could you please walk me through it step-by-step. I am still very new to "Flash Professional (CS5)" & "ActionScript (3.0)"
I am using Flash CS5 (assets) and FlashDevelop (code) for my project. We have about 20 fla/swf's that contain textfields. All of our textfields use the same Font, and the font is specific to our company so won't be installed on anyones computers, hence it needs to be embedded.
My ultimate goal is to have one single font embedded that all of the textfields use, for 2 main reasons:
Whenever we add more characters to the font (other languages), we only need to add them once and not 20 times The file size doesn't blow out dramatically
I'm having great difficulty in trying to achieve this. It seems that everything I try, characters are missing (only characters entered in the text property of the textfields in each fla seem to be embedded).
The latest solution I am trying is using Runtime Shared Libraries, as this seems like it should work. I have an fla called FNFont.fla. It contains just one object in the library, the embedded font. The font is exported to AS3, exported in frame 1 and exported for runtime sharing. The URL is FNFont.swf (all swf's are in the same folder).
In all the other fla's, I create the font object in font embedding. I tick Import for Runtime Sharing and give it the same class name as the one in FNFont.fla. The URL is FNFont.swf. The fla(s) contain many textfields using this font. The textfields have instances of themselves as children of other movieclips.
When I run the program and attempt to load a movieclip that contains an instance of one of these textfields, I get the error:
[Fault] exception, information=ReferenceError: Error #1065: Variable FontName is not defined.
FontName is the class name of the Font object in FNFont.fla and all other fla's. It is not the instance name of the textfield (nor the class name), so I don't understand how it thinks its a variable.
This is the concept I want to get into code: 1) Have a Document Class attached to the Main.swf 2) Have a Assets.swf that has all MovieClips that set to Export and have been given actual Classes. 3) Have the document class Load the Assets.swf. 4) Once loaded, be able to create instances of the MovieClips from Assets.swf by writing the code in the Document Class of Main.swf
I can get all this to work.. However what I am finding is if I have a public function on the Document class that creates an instance of something from the Assets.swf, lets say var okTest:TestClass = new TestClass(); I have to also import it in the Document Class (import com.test.TestClass). When I compile it, yes it works. If I remove the Assets.swf file it doesn't display. Ok.. But I've noticed that the Main.swf file is including all the imported classes (eg: com.test.TestClass) so the Main.swf filesize is pretty much the same as the Assets.swf file.
I also ran it through a decompiler and can see yes in fact Main.swf is including all those Classes from Assets.swf because I'm trying to access them from Main.swf and had to import. So the biggest question is how do I go about this properly? Being able to load the asset file that has movieclips etc that have custom classes. Then create instances of those classes within the document class but only if Assets.swf is loaded.
I think I basically get runtime shared libraries, but I have some very specific questions which I have not been able to find answers for anywhere:
1) When you load swf "A" that references a runtime shared library swf, does the entire runtime shared library swf also immediately load? (true/false)
2) When swf "A" instantiates a symbol that is linked to be imported from the runtime shared library, does the entire runtime shared library swf load then? (true/false)
3) When swf "A" instantiates a symbol that is linked to be imported from the runtime shared library, does only that specific symbol load? (true/false)
My problem is, if I put all my bitmaps in swf "A", then it takes a really long time to load. I'm wondering, if I put all my bitmaps in a runtime shared library, and link the symbols in swf "A" to the runtime shared library, then will swf "A" load fast (because the runtime shared library is not loaded)? And when I instantiate a linked symbol, will it also load fast (because the entire runtime shared library is not loaded)?
I keep getting this warning coming up everytime I go to preview my file. Can anyone help me prevent this warning from coming up? I tried to create a seperate preloader for the website I'm making and that didn't work, and I think it might be because of this Runtime warning in my main file.
I recently switched a Flex project over to using RSLs. It built fine for quite a while but has recently dug its heels in and is giving me this error:configuration variable 'runtime-shared-library-path' requires a value for 'rsl-url'I went through all the flex XML files I could find and either this value doesn't exist or there are entries available for it. Nowhere did I see a <rs-url></rs-url> with no value.
Summary: I don't quite understand how the import/export URLs for symbols in a runtime library work. I can't figure out how I can set them so that the runtime library will be properly loaded and accessible for other swfs to import from, if I want it to work both in a local environment (on my harddrive), and from a remote environment (on a web page).
Relative URLs seem to work great for the hard-drive case, but fail for the web page. Is there a magic way to set the relative URL to work from the web too? And/or, is there some way of manually loading up the RSL at runtime and making the importing swfs import from that loaded copy, rather than having Flash doing it behind the scenes based on the import URL set in the symbol? Following is a longish description of what I'm trying to do, and why... I'm trying to figure out if we can use RSLs to contain common UI controls for our next project. I'm running into an organizational issue that I can't quite figure out - how to get the RSLs to work in both a local development/debugging environment, and on a production web environment, with the same exporting/importing URLs.
Here's what my setup would look like. Say I have a main application main.swf, an RSL lib.swf, and a UI module dialog.swf. Main.swf loads or embeds dialog.swf. lib.swf exports some symbols that dialog.swf imports. On a local development environment, these swfs are found in folders like so:
I'm trying to figure out if we can use RSLs to contain common UI controls for our next project. I'm running into an organizational issue that I can't quite figure out - how to get the RSLs to work in both a local development/debugging environment, and on a production web environment, with the same exporting/importing URLs.
Here's what my setup would look like. Say I have a main application main.swf, an RSL lib.swf, and a UI module dialog.swf.
Main.swf loads or embeds dialog.swf. lib.swf exports some symbols that dialog.swf imports.
On a local development environment, these swfs are found in folders like so:
[URL]
Here is the problem. If I set the export/import url for symbols in lib.swf to "assets/lib/lib.swf" (relative to the location of main.swf), the runtime library gets loaded fine in the local environment. But in the web environment, it does not load - the player just shows the "..." graphic indicating it is trying to load.
Alternatively, I can use "http:/myapp.com/assets/lib/lib.swf" as the export/import url. Now, it will work in the web environment. However, in the local environment, dialog.swf will load symbols from the lib.swf that is out on the web, not the one that is local. But I need it to load from the local version, so that designers can muck about with the assets and see the results locally before publishing to the web.
Is there some alternative way to set up the swf's, or way to set the URLs, or some other hoop I can jump through that will make the RSL load properly in either environment without having to manually change URLs all the time?
(Details: I am using Flash Builder 4, CS 5, Action Script 3, Flash Player 10... No Flex! My example omits some details from my actual setup, such as the fact that we are using a preloader to load the main application, and a php script on the web page to start the preloader.)
I am working in two different applications, one to be compiled for desktop use (AIR) and one to be compiled for the web. They are part of the same project and use the same visual components, but they are completely different apps. When a visual component is changed in one application then it should also change in the other one. Is this a good situation to use a shared library fla? I am new to the concept of shared libraries and I am considering the options.
On one had I would not have to update 2 applications everytime I change something, on the other, I would always have to recompile the library folder when I do the smallest changes to a component.
I am creating a library in AS3. Inside the library I make use of a bunch of classes/packages that need not be exposed to the end user of my lib. I want to only expose one of these classes.
I guess my questions are:
1) How are libraries commonly distributed in AS3?
2) Is there a .jar equivalent in AS3 that developers can include, but will only have access/knowledge of the classes I've declared as public?
I have only ben using flash for a little while and do not know a lot about action scripts.I have used a flash file found online which plays music and has a mute button, but at present it plays the music when the page is viewed at another time.So need to have a cookie or shared obect as i have been told it is, so that when the music tries to play it can read the mute state cookie to decide if it should play or not.i see i can not upload a file so have uploaded to the following location
How can I do the following in Flex 4.5 or later: Compile an swc library file containing packages of simple functions Compile an swf application referencing the swc file as RSL Publish the swf application Send the source code of the swc file to another developer Allow the developer to modify the code of some functions while keeping their interfaces Allow the developer to compile the source code into a new swc file using only compc Allow the developer to replace my original swc file with his new swc file, then execute my swf application having the new swc file in the same directory.
Suppose that I have two applications running on the same page. I have the Libraries compiled into the SWF file: [code]Is RSL intended to just improve the download time (via caching) or does it also lower the memory foot print of an applicaiton?
Preface: I'm using Flash CS4 Professional for the Mac, AS3 and Flash Player 10.
I have an RSL (runtime shared library) SWF that contains bundled classes which I store in an online location. I also have another SWF that access that runtime shared library in order to instantiate it's classes and use their methods/functions.
I have a an array of a custom class that I'm trying to store in a SharedObject.Storing is working fine, but when I recall the SO next compile it only returns an array of generic Objects instead of my custom class. This only happens with custom classes.Code excerpt below, this may be way too cut out, but it seems it's what I've narrowed the problem down too.[code]
I've been working in as3 for quite a while now, trying various methods of loading in XML and parsing it between custom classes - from storing the XML data using objects, storing it in arrays and then parsing it to my custom classes, or parsing XML nodes directly between their relevant classes. how best to store and parse data from XML throughout my classes.
Should I be extracting it all in the document class first, into arrays or objects, and then parsing the array or object to the relevant class? Or simply parsing the XML node that relates to the class and extracting the data there?I've also heard that looping through XML and storing the data in multi-dimentional arrays before parsing it, is the way to go.. some have also suggested using a separate public data class or singleton class to store all the variable data from xml.. and referencing it globally in each class.
I've been working in as3 for quite a while now, trying various methods of loading in XML and parsing it between classes - from storing the XML data using objects, storing it in arrays, or parsing XML nodes directly between their relevant classes. Should I be extracting it all in the document class first, into arrays, or objects and then parsing the array or object to the relevant class? Or simply parsing the XML node that relates to the class and extracting it there?I've also heard that looping through XML and storing the data in multi-dimentional arrays before parsing it, is the way to go.. some have also suggested using a separate public data class to store all the variables from xml.. and referencing it globally.
How do Static classes work in projects where child swf's use the same Static class as their parent?
For simplicity... lets say we have some older content swf files that are using TweenLite version 8 ( a common enough Static class.) But the parent SWF is being updated and uses a more recent version of TweenLite (version 10). The child SWF's are loaded into the parent SWF. Do the child SWF exist in there own sandbox and have TweenLite version 8 running and the Parent runs it's own copy of TweenLite 10? Or does the parents clips Static class of TweenLite (version 10) overwrite the children Static class using some sort of magical shared memory space when JIT (runtime) compiling?
In my child swf I am using the sound from library with "attachSound". I also use the play/pause button controls of this sound alongwith the other animation.
Now when I load this into my main swf file with "loadMovie", It plays fine but no sound. I found that this is due to no sound linkage in my main file library.
Is it possible to store instances of a class in a cookie or in shared objects.
Basically in my application I have an object "Diagram" that the user can create. If they hit save, I want to store the current instance as a cookie and allows them to reload it later.
Alternatively, I could see about getting them to store the saved version on the hard disk. But even then, all I want to save and retreive is my actionscript object.
I've tried storing the object to SharedObject.data.diag, but when I try to retrieve the object from the cookie doing SharedObject.data.diag as Diag returns null.