Solved

Duplicate Movie Clip Pullling from Array

Posted on 2003-10-31
6
314 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
air/as3 : is there a way to simulate TouchEvents? 1 429
SCCM 2012 - Deploy Flash 16 6,958
To view Flash technology content error 4 6,575
flash professional 3 11
I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
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,…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
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.

810 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