View Full Version : All Classes External SWF
TjOeNeR
05-28-2005, 01:08 PM
Hi
I'm using and reusing a lot of classes in a dozen swf files.
But in every file it takes up about 24k
Is there a way that I can put all the classes into one swf and load it in the beginning???
Tnx
Brajeshwar
05-28-2005, 04:16 PM
Yes! Isn't that actually what we do most of the time, put things which are common together.
TjOeNeR
05-29-2005, 09:06 AM
Yes, but the problem is, when I embed a class in an external file, it doesn't work
I load it, loads fine, but when I make a new Object from that class, it doesnt work :s. It just returns nothing...
hangalot
05-29-2005, 09:40 AM
check out ariaware optimizer. thats what it does exactly. link:
https://secure.ariawareoptimizer.com/purchase.php
its really quite amazing how much it will shrink it all if you use multiple swf on the same page
TjOeNeR
06-01-2005, 02:05 PM
I found that allready, but it should be possible manually
_Lexicon_
06-01-2005, 03:28 PM
You can create a shared code library. The library needs to basically just be a list of class names (as in example).
The drawback is that you need to create an exlude xml file (following the naming convention in the example) for each swf using the classes in the library0( so that they are compiled without inluding those classes).
See attachment as it is easier to just look at it rather than explain...
TjOeNeR
06-02-2005, 05:24 PM
LOOOL
That's exactly what I did, with the XML file and everything, and it doesn't work. I believe it has something to do with the trace actions, but I'll investigate ;)
Thnx alot
TjOeNeR
06-02-2005, 05:39 PM
I found out that it has something to do with my barbarian way of loading swf files.
I made a person_extern.fla with the following code in
_root.createEmptyMovieClip("holder_mc",1);
holder_mc.loadMovie("Person.swf"); //Holds the Person class
holder_mc.onLoad = function() {
var my_person:Person = new Person("name",15);//name,age
trace(my_person.getInfo());
};
Man i bet it's this code that doesn't work.
hangalot
06-02-2005, 06:53 PM
http://osflash.org/doku.php?id=using_a_swf_as_a_dll.
_Lexicon_
06-03-2005, 08:20 AM
I found out that it has something to do with my barbarian way of loading swf files.
I made a person_extern.fla with the following code in
_root.createEmptyMovieClip("holder_mc",1);
holder_mc.loadMovie("Person.swf"); //Holds the Person class
holder_mc.onLoad = function() {
var my_person:Person = new Person("name",15);//name,age
trace(my_person.getInfo());
};
Man i bet it's this code that doesn't work.
no it doesn't. Try the MovieClipLoader class instead.
this.createEmptyMovieClip("holder_mc", 1);
var mcl_listen:Object = new Object();
mcl_listen.onLoadComplete = function(target_mc:MovieClip)
{
trace("LOADED");
};
var myMCL:MovieClipLoader = new MovieClipLoader();
myMCL.addListener(mcl_listen);
myMCL.loadClip("Person.swf", holder_mc);
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.