Skip to main content
FrankPod
Participant
April 12, 2026
Answered

I can't access deeply nested objects in other objects via Action Script 3. How should I approach this?

  • April 12, 2026
  • 1 reply
  • 33 views

Whenever I try to modify/read deeply nested MovieClip objects, output gives me typeerror #1009, but when I cast those objects as movie clips I get typerror #1010. I understand them both, but I don’t know what to do with that, as simple

trace(object.nestedObject.deeplyNestedObject);

would give me errors. Details that might be relevant:

  • Strict mode is on, and I want to keep it on.
  • Those objects are nested via Adobe Animate gui and all of them have proper instance names.
  • Advanced layers are turned off.
  • Error is still thrown when code is putted inside deeply nested MovieClips frame.

How can I fix this and how generally should I approach accesing nested objects?

    Correct answer FrankPod

    I did check a bit and found out that

    • named instances that aren’t in the first frame are considered unidentified
    • program doesn’t like when there are different objects under the same instance name in multiple frames, but only when they are deeply nested (the ones after first are considered null, even tho they render).

    I probably should have said it sooner, but in project I try to have most things done by object from manager class and so the problems might come from that approach.

    I have some objects that I want to be replaced in a certain frame after 3rd repeat, but it will be considered undefined. Theoretically I could just make another layer with the same object and instance name, on all the other frames, under mask layer so viewer wouldn’t see behind the scenes, but that feels like just going around the problem and not really fixing it. Is there better solution to this or things I need to know?

    1 reply

    kglad
    Community Expert
    Community Expert
    April 12, 2026

    start with the deepest object and use trace(this, this.name)

     

    then move up one level and do the same for the parent, etc

     

    or just write iterative code on the main timeline going deeper and deeper with anything with numchildren >0

    FrankPod
    FrankPodAuthorCorrect answer
    Participant
    April 13, 2026

    I did check a bit and found out that

    • named instances that aren’t in the first frame are considered unidentified
    • program doesn’t like when there are different objects under the same instance name in multiple frames, but only when they are deeply nested (the ones after first are considered null, even tho they render).

    I probably should have said it sooner, but in project I try to have most things done by object from manager class and so the problems might come from that approach.

    I have some objects that I want to be replaced in a certain frame after 3rd repeat, but it will be considered undefined. Theoretically I could just make another layer with the same object and instance name, on all the other frames, under mask layer so viewer wouldn’t see behind the scenes, but that feels like just going around the problem and not really fixing it. Is there better solution to this or things I need to know?

    kglad
    Community Expert
    Community Expert
    April 13, 2026

    you are incorrect.

     

    to start, 

    • named instances that aren’t in the first frame are considered unidentified

    is wrong, but if you’re trying to find it before it exists, of course, that won’t work.