attachMovie the duplicate
- Started
- Last post
- 13 Responses
- wade
Can anyone write the code on how to first attach a movie to an empty movie clip then duplicate it and change it's y position in Flash ActionScript? I bet you can't.
- wade0
I know someone knows the answer. Come on!
- unfittoprint0
u can attach.
u can duplicate.
u can't duplicate & attach.
- wade0
You mean it's not possible to first use attachMovie and then duplicateMovieClip on the attached clip?
- unfittoprint0
an example:
for(i=0; i < 20; i++){
this.attachMovie("symbol", "symbol"+i, i++);
this["symbol"+i]._x = this["symbol"+i]._width * i;
}
- wade0
Ok, yeah that makes sense. So if I was creating something like a menu, where I needed to duplicate an MC mulitple times for each menu item, it would be better to just put the MC off the stage and use duplcateMovieClip instead of pulling it from the library with attachMovie first?
- imakedesign0
Load your swf into a empty_mc:
_root.empty_mc.loadMovie("your.s...
now i think you can do anything to that movieclip as you can do normally.
- Anarchitect0
//an easy way to make a menu.
nav = Array("section1", "section2", "section3");
for(i=0; i < nav.length; i++){
label = nav[i];this.attachMovie["symbol", "symbol"+i, i++, {label:label});
}
//inside your symbol, you could make a textfield that show your label and an onPress event to load your content
textBox.text = label;
this.onPress = function(){
trace(label+".swf");
_root.content.loadMovie(label...
}
- imakedesign0
sorry did not read your post properly.
- wade0
Anarchitect: Maybe I didn't explained myself well enough. I'm trying to create a drop-down or drop-up menu like the 'Broadcast Authors' and 'Preservation' menu on the left bottom of NewsToday. Only in Flash though. Is there an easy way to do this?
- tkmeister0
you can just use the dropdown component that flash come with.
- wade0
I could yes, but I don't know how to customize the components. It seems like a lot of work/searching the net and I was hoping for a quick solution so I can finish this project.
- unfittoprint0
you just have to tweak my a code a bit more.
that is a "constructor". it takes out the labels [which have the same name as the external /internal content that will be loaded through the menu] from an array [wich could also be created using an external xml file].
it uses a library instance to populate the menu, giving each attachmovie the correct label.
for a dropdown you should also take the following in consideration:
those buttons should be attached in a movie that will be made _visible == false soon as the user clicks a _parent trigger button and _visible == false soon as the user as made his choice.
those should be your top priorities to make a dropdown.
- wade0
Unfit, could you explain your code in more detail? What you mean by 'tweak it a bit more'?
for(i=0; i < 20; i++){
this.attachMovie("sy mbol", "symbol"+i, i++);
this["symbol"+i]._x = this["symbol"+i]._wi dth * i;
}