addchild in a movieclip in a movieclip in a movieclip

I would addchild to a movieclip who is in a movieclip who is in another movieclip.

I try:

this.profil.bonome0.bonome.addChild(conteneurImage);

and it doesn't work but this does:

this.profil.bonome0.addChild(conteneurImage);

how could I access to the third movieclip (bonome)?

Upvotes: 2

Views: 1201

Answers (1)

Marty
Marty

Reputation: 39476

Your syntax is perfectly fine and your code should work, assuming the following:

  1. A MovieClip named profil exists in the current context.
  2. A MovieClip named bonome0 exists within profil.
  3. A MovieClip named bonome exists within bonome0.

Point 3 is where you seem to be having trouble, so check to be sure that you have a MovieClip nested inside bonome0 with the instance name bonome.

To debug, you can trace each of the MovieClips until you hit undefined, which will mean you don't have a MovieClip nested with the instance name you're trying to access it by. e.g.

trace(
    profil,
    profil.bonome0,
    profil.bonome0.bonome
);

Upvotes: 1

Related Questions