简体   繁体   中英

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)?

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. eg

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM