First of all, try MovieClipLoader to load your swf's..

If you don't want to use a runtime shared library, then I'd suggest making each movieclip you want to load at runtime a separate swf.

You can export MovieClips directly from your library.

also, as long as it is set to export for actionscript, you can attach any MC you want, to any other MC you want at runtime.


On Aug 8, 2006, at 9:01 AM, Bart Albrecht wrote:

Hi,



I looked on the internet and did not find the answer. I read a few times
"can't be done"

What I want to do is load movieclips in my main.swf from a library.swf and put those movieclips on the root or put movieclips from the root in the
controller of my loadmovie.

Secondly I want to add a movieclip who is in my main.swf library to the
controller_mc. But this is not possible.



I also try to put a movieclip which I loaded from the library.swf to the
root. But also that is not possible.



I cannot make use of the shared library because the name of the library.swf
should be dynamic.



Here is the code:

Where I load a circle mc from the library.swf into the controller_mc. This
works.

Where I load a circleRoot mc from the library of the current swf to the
controller_mc. This does not work.

Where I load a circle mc from the library.swf onto the current root. This
also does not work.



this.createEmptyMovieClip("controller_mc", 1);

var libMovie = "library.swf";

controller_mc.loadMovie(libMovie);



this.onEnterFrame = function(){

            var tLoaded, tBytes;

            tLoaded = controller_mc.getBytesLoaded();

            tBytes = controller_mc.getBytesTotal();

            var percentage = int(tLoaded*100/tBytes);



            if (isNaN(tBytes) || tBytes < 4) return;



            if (tLoaded/tBytes >= 1) {

                        delete this.onEnterFrame;

//attach circle from library.swf to controller_mc in
the main.swf

controller_mc.attachMovie("circle", "circle_mc",
controller_mc.getNextHighestDepth());  //OK



                        //attach circleRoot from main.swf library to
controller_mc in the main.swf

                        controller_mc.attachMovie("circleRoot",
"circle2_mc", ", controller_mc.getNextHighestDepth()); //NOT OK

//attach circle from library.swf to the root of my
main.swf

                        _root. attachMovie circle", "circle_mc",
_root.getNextHighestDepth());  //NOT OK

            }

}



Is there perhaps an other way to load external movieclips from an other swf
(library.swf) onto the root of the main.swf?



Thx,

Bart





_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to