Solved

Duplicate Movie Clip Pullling from Array

Posted on 2003-10-31
6
332 Views
Last Modified: 2010-04-03
I am attempting to duplicate all of the movie clips on the stage and assign each one a different instance name with one function. I have all of the movie clip names contained in an array (only two now). I had the code set to step through the array and grabe each mc, put that mc through the function, and then viola....BUUUUT no. Hours and many drinks later....here i am.
The problem i am having is that when this is run, it ONLY duplicates one mc in the array. The trace shows all of the instance names....wierd.....thanks in advance!

Here is the code that i have ended up with (boiled down version):

_root.nameArray = ['mca','mcb1'];
count = 0;
alpha = 60;
mca._alpha = alpha - 5;
mcb1._alpha = alpha - 5;
yscale = mca._yscale *= .3;
yscale = mcb1._yscale *= .3;

function dupMc(mc){
      trace("MC:" + mc);
      
      /*
      if(count > 30)
      {
            clearInterval(ID);
            return;
      }
      */
      count = 0;
      while(count < 30){
      duplicateMovieClip(_root.nameArray[mc], _root.nameArray[mc] + count, count+10);
      setProperty(_root.nameArray[mc] + count, _y, mca._y-((count+1)*10));
      setProperty(_root.nameArray[mc] + count, _alpha, alpha + count*2);
      setProperty(_root.nameArray[mc] + count, _yscale, yscale);
      yscale = yscale-0.2;
      trace("y: " + _root.nameArray[mc] + count);
      count++;
      }
      
}
//ID = setInterval(dupMc(0), 50);
//ID2 = setInterval(dupMc(1), 50);
dupMc(0);
dupMc(1);
0
Comment
Question by:ninjagnat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 

Author Comment

by:ninjagnat
ID: 9661970
update points
0
 
LVL 27

Expert Comment

by:negatyve
ID: 9663295
_root.nameArray = ['mca', 'mcb1'];
count = 0;
alpha = 60;
mca._alpha = alpha - 5;
mcb1._alpha = alpha - 5;
yscale = mca._yscale *= .3;
yscale = mcb1._yscale *= .3;
function dupMc(mc)
{
      trace("MC:" + mc);
      // ATTENTION!! you are duplicating movieclip
      // over the movieclips you have created before,
      // using the same depth parameter
      var count = mc * 30;
      var duplicando = _root[_root.nameArray[mc]];
      // or, if the movieclip reside in this timeline:
      // var duplicando = this[_root.nameArray[mc]];
      for(var i = count; i < count + 30; i++){
            var newClip = duplicando.duplicateMovieClip(_root.nameArray[mc] + i, i);
            newClip._y = mca._y - ((i + 1) * 10);
            newClip._alpha = alpha + (i * 2);
            newClip._yscale = yscale;
            yscale -= 0.2;
            trace("y: " + _root.nameArray[mc] + i);
      }
}
//ID = setInterval(dupMc(0), 50);
//ID2 = setInterval(dupMc(1), 50);
dupMc(0);
dupMc(1);
0
 

Author Comment

by:ninjagnat
ID: 9663498
Still not working; it shows the movie clips in the trace trace("y: " + _root.nameArray[mc] + i) , but they do not duplicate. It is as if the for loop is just duplicating and then leaving them alone.

I appreciate your help greatly!! Any more ideas?

negatyve,
When i trace newClip from your code, it shows undefined.


Thanks!

-ninjagnat
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 27

Accepted Solution

by:
negatyve earned 250 total points
ID: 9663536
0
 

Author Comment

by:ninjagnat
ID: 9663656
DUDE! I bet you get ALL the chicks!! Thank you VERY much. I have no idea why it didn't work in my movie (obviously something i was doing wrong), but, I don't care, I just wanted to know if I was on the right track. Thanks again!

-ninjagnat
0
 
LVL 27

Expert Comment

by:negatyve
ID: 9664394
that's ok! :)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question