all groups > flash actionscript > january 2005 >
You're in the

flash actionscript

group:

loadMovieNum & attachMovie for Dynamic Library Access



loadMovieNum & attachMovie for Dynamic Library Access AlexMaghen
1/12/2005 11:22:58 PM
flash actionscript: Hi. I have two movies. One I'll call 'MAIN.swf' and the other I'll call
'DYNLOADED.swf'. DYNLOADED.swf is a movie which has a bunch of MovieClips in
its library that are all marked for actionscript export. The idea is that I
load this movie dynamically using loadMovieNum() and then I can instantiate any
of the movie clips from the loaded movie in other places throughout 'MAIN.swf.'
I'm having no trouble loading DYNLOADED.swf and I load it into _level99. I can
then test it and _level99 is, indeed loaded with DYNLOADED.swf and I can acess
its members, etc. But my problem comes when I try to use 'attachMovie()'
inside some movie clip within MAIN.swf. When I try to do this, nothing happens
and, of course, no errors are raised or anything so I don't know what happens.
I guess the most important question is this: If the SWF I loaded dynamically
into _level99 has a movie clip inside it named 'XYZ' and somewhere inside my
main movie I want to make that XYZ available (instantiated), I've tried
'this.attachMovie('_level99.XYZ', 'NewName', 100); and I've also tried
'this.attachMovie('XYZ', 'NewName', 100); Neither work. Ideas?
Re: loadMovieNum & attachMovie for Dynamic Library Access kglad
1/12/2005 11:39:53 PM
Re: loadMovieNum & attachMovie for Dynamic Library Access AlexMaghen
1/12/2005 11:45:06 PM
Hey thanks but I don't know what you mean. Can you point me somewhere where I can read about 'shared library assets'?

Re: loadMovieNum & attachMovie for Dynamic Library Access AlexMaghen
1/13/2005 12:53:29 AM
I found the 'Shared Library Assets' info in help and I get how it works... I
just don't particularly like how it works :). You have to insert hard-coded
URLs and the 'destination' movie has to have a fixed entry in it's library for
each item I may want to use. Kinda ugly. But here's the thing: I've noticed
that if I load a movie using loadMovieNum('xxx.swf', 99), I can successfully do
'_level99.attachMovie(...)' but if I do something like
'myMovie.attachMovie(...)', it doesn't work. In other words, there seems to be
a constraint not allowing me to do 'attachMovie()' for assets that are not
originally FROM this SWF. Is that the rule? Is there no way around it? Alex
Re: loadMovieNum & attachMovie for Dynamic Library Access kglad
1/13/2005 1:34:27 AM
Re: loadMovieNum & attachMovie for Dynamic Library Access AlexMaghen
1/13/2005 5:20:12 PM
Just one more question on this and I promise to leave you alone :) Is there any
way to dynamically change the linkage Url for the asset in the library that's
being shared from another movie? Or can the Url be RELATIVE? And does it
actually have to be a URL or can it be a relative file location? My main SWF
will be used both online AND on disk and I don't want to have to build two
different versions!
Re: loadMovieNum & attachMovie for Dynamic Library Access AlexMaghen
1/13/2005 9:09:18 PM
LAST QUESTION ON THIS TOPIC! Is there any way to control WHEN a Shared Library
movie from another SWF is loaded? The problem is that right now, it seems to be
loading immediately at the start of the movie, but that sort of defeats the
purpose of making the initial download for the movie as small as possible and
then loading the other stuff when needed. I tried not embedding the shared
movie in design-time but using attachMovie to insert it when needed but if the
shared library item isn't stuffed into the movie in design time, it seems I
can't use attachMovie() at run-time. Ideas?
Re: loadMovieNum & attachMovie for Dynamic Library Access kglad
1/14/2005 3:20:04 AM
AddThis Social Bookmark Button