views:

231

answers:

2

Hello again all, I have built a movieclip (parentMC) that houses two movieclips within it (mcA, mcB).

in mcA, i'm dynamically attaching movieclips from the library through a loop.

in mcB i'm trying to reference a particular movieclip from mcA via "_parent.mcA". Doesn't seem to be working. However, when i reference said movieclips from the loop within mcA - or even parentMC, it works fine.

is there a special path exception? i've tried using _root and even the _level paths and still no luck. All responses are appreciated!

A: 

Okay, here is what i have in mcA

for(i=0; i<5; i++){
   var dynMC:MovieClip = this.attachMovie('libMC'+i, 'newMC'+i, 10);    
}

and lets just say i want to move the dynamic clip in mcA from inside mcB

_parent.mcA.newMC1._y = 25;

that doesn't work, however these will work:

// in parent clip
mcA.newMC1._y = 25;

// in mcA
this.newMC1._y = 25;
A: 

One problem I can see is that your newMC clips are all being created at the same depth (10), so each will overwrite the last, leaving only newMC4 at the end...

Try this instead:

for(i=0; i<5; i++){
   var dynMC:MovieClip = this.attachMovie('libMC'+i, 'newMC'+i, this.getNextHighestDepth());    
}

Having done that, your _parent.mcA.newMC1._y = 25; line should work if everything is set up as you say, so something else might be wrong. Here are some things to try:

  1. Check that mcB's parent really is the same as mcA's, by adding trace("mcB = "+this); inside mcB, and trace("mcA = "+this); inside mcA.
  2. Check that your dynMC clips are being created correctly: add trace("dynMC = "+dynMC); on the next line after this.attachMovie....

Hope this throws some light on where the problem lies.

Richard Inglis
Richard, thanks for the reply - i am aware of the depth situation as this is not the entire code in the loop...just a simple reiteration of it.i've made sure that the clips are in place correctly and they all path correctly in the output - but when i try and trace them from mcB i'm getting "undefined"thanks for your reply.