Solved

Duplicate Movie Clip Pullling from Array

Posted on 2003-10-31
6
305 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

912 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now