Target mc's inside a mc placed with addchild

ISSUE 1)

  • I have an MC1 dragged on stage in keyframe.
  • MC1 creates a MC2 with addChild action.
  • MC2 creates MC3 with addChild action … addChild(obj[2]),
    so far so good and working fine.

In this MC3 there are 6 instances of MC4 placed in a keyframe, all of the 6 MC4 instances have instance name, “part1” to “part6”. I’m trying to position the 6 instances randomly on X-Y values with script in MC2;

var target:*;
for (j=1; j<=6; j++) {
target = “obj[2].part” + j;
target.x = Math.random()*20-Math.random()*20;
}

but I get a
ReferenceError: Error #1056: Cannot create property x on String.

I tried using Array and Object and MovieClip but none accepts it. In AS2 I
could simply use setProperty(“obj[2].part” + j, _x …
but in AS3 it’s removed.

funny is that
obj[2].part1.x = Math.random()*20-Math.random()*20;
obj[2].part2.x = Math.random()*20-Math.random()*20;
obj[2].part3.x = Math.random()*20-Math.random()*20;
etc
works fine.

I’m looking for the correct syntax in merging “obj[2].part” plus j together to be able to target it.

ISSUE 2)
in MC4 putting script
var myParent:* = MovieClip(parent);
trace(myParent)

indeed traces the linkage name of MC3 / obj[2] correctly but

trace(myParent.myParent)

results in Undefined, while MC2 DOES have a linkage name and should be traced fine. And

trace(myParent.myParent.myParent)

results in a

TypeError: Error #1010: A term is undefined and has no properties.

although MC1 ALSO has a linkage name and should be traced fine as well.
Any enlightenment on this phenomena? Does it have to do with fact that the 6 instances are placed in keyframe and not created with addChild?

P.