Skip to main content
Inspiring
January 17, 2007
Question

Load movie into holder clip not on frame 1

  • January 17, 2007
  • 1 reply
  • 154 views
Okay, here is the situation. I have a MovieClip, call it a_mc which has its
own class file. In it are several additional MovieClips, some with, and
some without class files. One in particular, call it b_mc, has a class file
and is used as a holder for several additional MovieClips. One of those is
an empty MovieClip with an instance name, call it holder_mc. However, b_mc
stretches over 100 frames, and holder_mc does not appear on a keyframe until
frame 30.

Now, I have a method in the class file for a_mc that uses a MovieClipLoader
to load a thumbnail into holder_mc, so the call to load the clip looks like
this
my_mcl.loadClip(filePath, b_mc.holder_mc);

Now, this does work... but only intermittently, and only about 5% of the
time. Since I am from a programming background and never really learned
actionscript in a multi-frame environment I have a feeling it is because the
frame has not been reached with the holder_mc MovieClip when the call to
load is executed. Everything I do is always in a single frame even though I
know that is not taking full advantage of stuff you can do with Flash.

My solution was to make a copy of holder_mc and place it on the first frame
off the stage (figured it was better than making 0 alpha for processing
sake) and that took care of the problem.

But, is this the only way to do this? Or would I have to do something like
put my call to loadClip in an onEnterFrame that is checking to see if frame
30 has been reached, then loading the picture into it?

Thanks for any insight.



This topic has been closed for replies.

1 reply

Inspiring
January 17, 2007
Yep, you have answered your question. Normally when you are using classes it is not so good to depend on the objects placed in different places of the class container movieclip. The common approach is to create an onEnterFrame event on the empty moviclip, wait until frame 30 and then execute the loading, finally deleting the enterFrame. Another approach is to use the setInterval function to make the loading perform at an specified point time.