Solved

Duplicate Movie Clip Pullling from Array

Posted on 2003-10-31
6
329 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
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…
The goal of the tutorial is to teach the user how to how to record live broadcast.
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.

734 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