PDA

View Full Version : load MC into empty MC


TBoyB
09-03-2001, 02:37 PM
What is the syntax for loading an MC into an empty MC on the stage?

Will that in effect replace any MC that is currently loaded into that same empty MC?

I wish to use buttons to load various MCs into an empty MC so that each one replaces the other.

I know I have asked this before, but I still haven't gotten a clear answer on how to do this. Please, Someone, I'm stuck on this one!

TIA.

Jesse
09-04-2001, 09:18 AM
'Load' is a confusing word in this case. Do you want to load external movies (swfs) or attach library elements (mcs)?
If you want to load SWFs it's just:
loadMovie("file.swf","_root.targetInstanceName"); and yes, it will overwrite any existing content in the movie clip.
if you want to pull items from the current swf's library then you need to use attachMovie. See the tutorial. Once you know how to use it you can use:
_root.targetInstanceName.attachMovie('linkName','n ewInstance',depth); where depth is a value. A depths of 0 may overwrite the current content. If it doesn't you'll have to unload the other content by othe remans. I tend to keep an entirely empty movieclip in my library which I then attach to the stage before I attach otehr stuff to it, or load movies (swfs) into it. that way you know it's empty.

TBoyB
09-04-2001, 03:35 PM
Thanks Jesse! I've been trying to get an answer on this for months now.

Yes, I want to load MCs from the library. Yes, I allready have an empty MC on the stage. What does "linkName" refer to and what does "newInstance" refer to? Depth I understand. Does "linkName" refer to the name of the MC in the library? and does "newInstance" mean I then give it a new name on the stage?

And now the part you are going to hate....what is that syntax for Flash4? I want to use it because of it's wide spread current install base. I know I know, if we don't promote Flash5 how will it ever acheive the same install base, but this is for a client and we don't want customers having to download a new player or plugin.

Where is that tutorial you spoke of?

TIA.

Jesse
09-05-2001, 03:08 AM
there is no eqivalent for flash 4. you would have to put one copy of each movieclip on the stage (but off the screen) then duplicate it when needed. taking objects from the library dynamically is possible only in Flash 5 and is called 'attaching'. http://www.actionscripts.org/tutorials/beginner/attachMovie/index.shtml