PDA

View Full Version : mc within mc on-the-fly


icare
05-31-2005, 04:15 PM
Hi,

Can anyone indicate where i can find some clues to populating an MC ( visible on the screen ) with a smaller mc ( that are in the library thus invisible on the screen ) ?

I'm familiear with
duplicateMovieClip( target, newname, dept );

The "target" above is the name of the movie clip to duplicate, right ?
What about the TARGET to WHERE this "target" is meant to be duplicated. How do one define this ?

TARGET.duplicateMovieClip( etc...) ?

Thanks for any examples.

Flash Gordon
05-31-2005, 04:30 PM
container_mc.attachMovie(oldname, "newName");

icare
06-01-2005, 02:41 PM
Thanks for the hint :-)

Finally got it right ! I thought maybe some other beginner might be interested:



// create or retreive the dynamic array of btnname and btnpaths

btnnames=new Array("FRANCE","GERMANY","SPAIN","ENGLAND");

btnpaths=new Array("paris","berlin","madrid","london");


// attach the movieclip instances

for(var i=0;i<btnnames.length;i++) {

//mcdoc is a buttonlike mc with emptybutton (btn) and textfield (btntitle)
//mcdoc is in the library and not on the scene
//mcdoc is exported for actionscript

name="mcdoc"+i;

//docwin is an empty MC container
//docwin is on the screen

_root.docwin.attachMovie("mcdoc",name, i+10,{_x:4, _y:(i*22)+4});
_root.docwin[name].btntitle.text = btnnames[i];

// assign a getURL event for each mc_instance

_root.docwin[name].URL = "http://www."+btnpaths[i]+".com";
_root.docwin[name].onRelease = function(){ getURL(this.URL) };

}

icare
06-01-2005, 02:42 PM
Thanks for the hint :-)

Finally got it right ! I thought maybe some other beginner might be interested:



// create or retreive the dynamic array of btnname and btnpaths

btnnames=new Array("FRANCE","GERMANY","SPAIN","ENGLAND");

btnpaths=new Array("paris","berlin","madrid","london");


// attach the movieclip instances

for(var i=0;i<btnnames.length;i++) {

//mcdoc is a buttonlike mc with emptybutton (btn) and textfield (btntitle)
//mcdoc is in the library and not on the scene
//mcdoc is exported for actionscript

name="mcdoc"+i;

//docwin is an empty MC container
//docwin is on the screen

_root.docwin.attachMovie("mcdoc",name, i+10,{_x: 4, _y: (i*22)+4});
_root.docwin[name].btntitle.text = btnnames[i];

// assign a getURL event for each mc_instance

_root.docwin[name].URL = "http://www."+btnpaths[i]+".com";
_root.docwin[name].onRelease = function(){ getURL(this.URL) };

}

cxn926
06-01-2005, 02:45 PM
you double posted right there