add movieclips from where? the library? if yes, use attachMovie(). if external swf files, use loadMovie or loadMovieNum() or loadClip().
and what movieclips do you want to "swap". an on-stage movieclip with a library movieclip or external movieclip.
and what do you mean by inserting script into something? you want to apply actionscript to a run-time creation?
I already figured out how to add and swap movieclips, I wasn't asking about them.
Yes, I want to as actionscript to a run-time creation.
For instance, I add a movieclip to the stage using attachMovie() and I want it to respond to mouse clicks. Somehow I need to insert code into it.
I could have sworn I saw something about it when I wasn't looking for it. But now my searches are turning up blank, so I must be using the wrong search terms.
OH! wait a sec... I think you did that in a peice of code you posted in a different topic.
Let me see, how about this...
Say I now have a movieclip instance names "myMovie", I add stuff by:
myMovie.onRelease = function()
Is this correct?
when you create a movieclip using attachMovie(), you assign it an instance name. use that code for mouse handlers or use the return from attachMovie():
// do whatever
Ok, I thought I was starting to figure out actionscript's eccentricities, and then this happens...
I have no script that adds handlers to the movieclip produced by attachMovie(), and yet the movieclip is appearing with functionality?
I click a button, and it makes a new movieclip appear. When I click on the new movieclip, it does stuff, even though I haven't given it any on (release) code yet? Um...?
Additionaly, the movieclip seemes to be stored in the library with child parts already added to it, and I can't 'open' it up anymore by double-clicking on it. Am I to understand that scripts made during authoring are saved to a movieclip even if that clip is deleted from the stage?
EDIT: double-clicking opens up the movieclip again. It must have been some strange glitch.
is this thread closed or do you still have some problems scripting new created movieclips?
I just didn't realize that movieclips retained code while they were in the library. So I don't need to add code to run-time created movieclips in the first place anymore. So I guess it's closed.