let's say you have a movieclip on stage with a instance name - myClip. To duplicate it 5 times, and position them next to each other, you could write a code like this.
Would you mind explainine what the width=.. is at the top, what the i symbolize, and the ["m"+i] things represent? And will the duplicated movieclip hace the same AS as the original (assuming i put some AS in the parent MC)?
Last edited by grindking01; 12-05-2005 at 01:11 AM.
the first line in the code indicates a variable that is set. the variable is named - "width" and it is equal to the width of the movieclip that will be duplicated. the number 5 tells flash to put a space of 5 pixels between the movieclips. The next lines is called a "loop" cause we want flash to duplicate more than 1 instance of the movieclip. The letter "i" is used commonly as a variable to pretty much keep a count of the duplicated movieclips, basically we creating an array of clips, and letter "i" is a variable that separates the movieclips while keeping the same new name, in this case "m". When flash duplicates a movieclip, it gives each dupe a new name, followed by a number. That number is represent by the letter "i".
You could just as easily duplicate a movieclip like below;
PHP Code:
duplicateMovieClip("mc", "m", 1);//where mc - instance name, and m - //newname
m._x = mc._width+5
you can copy either script and put them on the time line. Just make sure you give the main movieclip the instance name. Hope this helps
If you don't think you're going to like the answer, then don't ask the question.
Yes, I want food_mc to appear within the constraint variables, when the snake_mc comes in contanct with it that mc goes away and another duplicate is made, like snake that u have on cell phones and such.
When you want to use a movieclip for duplication, you have to do a 'linkage' to it. Right click the movieclip in the library that you want to be duplicated and select 'linkage'
Now click the check box 'Export for Actionscript', and in the text field , type in the name of the movieclip in which it will be called in the code (usually what it goes by in the library name)
No i cant open it.. u can save as, then select Flash MX from the file format dropdown menu..
u may have to change some AS tho :s if not can u PM me the changed scripts or something (sorry for the trouble)?