Groups | Blog | Home
all groups > flash actionscript > may 2006 >

flash actionscript : Loading External Clips: Why is a new "instance" clip created?


David Stiller
5/16/2006 4:45:48 PM
[quoted text, click to view]

I'm curious, shyaway, why you seem to prefer the loadMovie() function
over the MovieClip.loadMovie() method. Not objecting -- just curious.


David
stiller (at) quip (dot) net
Dev essays: http://www.quip.net/blog/
"Luck is the residue of good design."

jfred1979
5/16/2006 7:41:26 PM
When I load an external movie clip using loadMovie, or the MovieClipLoader
class, there is always a subclip named "instance" followed by an instance
number attached to whatever clip I am loading the external swf into. For
instance, I have a clip on the stage called "container". I load an external
clip like this:

container.loadMovie("clip.swf");

"clip.swf" ends up in container.instance01, rather than container. Is there a
way to load a clip into container, the same way using attachMovie with a local
library clip would?

shyaway
5/16/2006 8:13:12 PM
jfred1979
5/16/2006 8:24:01 PM
Still ends up as "instance1" within the "container" clip.
Rothrock
5/16/2006 8:36:58 PM
Because this is the way you have made it.

Every movieclip has an instance name. If you don't assign one then Flash just
starts instance1, instance2, etc.

So obviously in your clip.swf there is a clip at the top level containing all
your content and you haven't given it a name. I've seen this before, but can't
quite recall the crazy thing you are doing that none of us here would ever
think of.

Something like, you aren't exporting or publishing from the file menu ?
instead you are doing some export directly from the library?
shyaway
5/16/2006 8:39:26 PM
_root.createEmptyMovieClip("mc",1);
loadMovie("img/arrow1.GIF",mc);
for (var i in mc){
trace(i);
}
//no output
for (var i in _root){
trace(i);
}
//output: $version
// mc

so, you wanna post some of your codes and see where the problem is?
shyaway
5/16/2006 10:54:02 PM
just a personal perference, i guess.

jfred1979
5/17/2006 5:01:05 PM
<blockquote>quote:<br><hr><i>Originally posted by: <b><b>Rothrock</b></b></i>
Because this is the way you have made it.

Every movieclip has an instance name. If you don't assign one then Flash just
starts instance1, instance2, etc.

So obviously in your clip.swf there is a clip at the top level containing all
your content and you haven't given it a name. I've seen this before, but can't
quite recall the crazy thing you are doing that none of us here would ever
think of.

Something like, you aren't exporting or publishing from the file menu ?
instead you are doing some export directly from the library?<hr></blockquote>


jfred1979
5/17/2006 5:15:58 PM
<blockquote>quote:<br><hr><i>Originally posted by: <b><b>Rothrock</b></b></i>

So obviously in your clip.swf there is a clip at the top level containing all
your content and you haven't given it a name. I've seen this before, but can't
quite recall the crazy thing you are doing that none of us here would ever
think of.

Something like, you aren't exporting or publishing from the file menu ?
instead you are doing some export directly from the library?<hr></blockquote>

That was the problem! I was exporting the swfs directly from the library. For
some reason when you export a movie directly from the library and then load it
into another clip a generic instance name is created on top of the clip you are
loading it into. When you publish a clip normally and load it into another
clip, it retains the instance name. Problem solved, thanks!

Rothrock
5/17/2006 5:50:25 PM
Glad that worked out. I would expect the generic instance is there regardless
of if you load into another clip or not ? you just don't notice it otherwise!

But then again, "If a tree falls in the forest?"
AddThis Social Bookmark Button