2 Replies Latest reply on Sep 9, 2013 3:21 PM by James22s22

    Calling setChildIndex on a MovieClip causes it to lose all keyframe information.

    James22s22 Level 1

      Same problem from 2008 still exists: http://www.kirupa.com/forum/showthread.php?285768-movieClip-stops-tweening-after-setChildI ndex.

      Also described here: http://www.actionscript.org/forums/showthread.php3?t=258181  "Flash usualy does remove the instances even after you have controlled their position. But messing with their childIndex greatly confuses the player and makes it lose track of the instances."

      And encountered again here: http://board.flashkit.com/board/showthread.php?818335-setChildIndex-kills-frame-animation, and the last post (i.e. the end result of the situation) was the person saying "This is why I don't use timeline's anymore." ... which leads me to my point.


      In educational software, I have lessons set up where each frame is one page with content.  Some pages are interactive.  When the playhead moves to a different frame with different content, flash normally removes the content from the previous frame and loads the content for the new frame.  That's basic keyframe functionality, and is kind of the whole point of using keyframe animation software... when you insert a blank keyframe, you expect the content from the previous keyframe to be removed.


      Well, I'm finding that calling setChildIndex on a clip destroys the keyframe behavior for that clip.  For example, I have some drag/drop functionality, and when moving on to the next page/frame, items that should not be there are persisting onto the next frame.  This occurs when an item is dragged and setChildIndex is called to move it to the foreground.


      Once setChildIndex is called, the object seems to lose its keyframe information, because it is not removed on the next page; it remains.  If you then return to the previous page, a 2nd copy of the object is constructed, while the first copy is still visible.


      That's the kind of behavior I would expect for a dynamically added child (persisting across keyframes), but not the behavior I would expect from an object that was defined on the stage in the designer.  Years ago, when Macromedia owned Flash, that clear distintion existed (designer objects were at negative depths and could not be removed unless swapped into a positive depth, which made sense).  Now, it seems that there is no such distinction, and changing the child index of any object for any reason seams to rip it out of the keyframing system.


      Is this behavior described anywhere in the documentation... specifically that calling setChildIndex on an object causes it to lose all keyframe information?

        • 1. Re: Calling setChildIndex on a MovieClip causes it to lose all keyframe information.
          kglad Adobe Community Professional & MVP

          there's a known flash bug when using the timeline and changing an object's depth.

          1 person found this helpful
          • 2. Re: Calling setChildIndex on a MovieClip causes it to lose all keyframe information.
            James22s22 Level 1

            I wonder if it's really a bug or if it's a design issue.  Seems like a design issue to me -- something not easily fixed without a major reworking of the timeline code.


            Here's someone's post on stackoverflow with the exact problem and even the same scenario that I'm encoutering: http://stackoverflow.com/q/6822416/88409
            "The problem is that when I move to a different key frame on the timeline using gotoAndStop, the symbols that were touched by AS3 in the previous frame, even if they are not referenced by the designer's key frame, show up on the stage. It is as though any DisplayObject that I touch with AS3 becomes divorced from the timeline.


            It definitetly is triggered by operating on the child's depth directly, because changing it's depth indirectly doesn't cause the issue.  For example, if your timeline starts out with 2 objects, you can insert new objects via ActionScript at depths 0, 2, and 4, causing both original object's depth to change, but the problem doesn't occur and keyframing for those objects remains intact.  If you move the the next frame, which is blank, the keyframed objects are removed as expected, and when you go back to the first frame, the keyframe objects are recreated as expected (on top of the dynamically created objects).


            So it almost seems like something in setChildIndex is expliticly deactivating the keyframing, because a depth change alone isn't causing the issue.


            Problem also seen here: http://www.actionscript.org/forums/showthread.php3?t=262797


            And seen here where someone is trying to do a 3D rotating ring of clips using the timeline and setChildIndex: http://board.flashkit.com/board/showthread.php?775200-Z-Order-setChildIndex-problem

            This problem, on a scale of 1 to 10, is an 11.... rendering the products advertised features useless, because it creates a complete incompatibility with using keyframes and ActionScript.  It's also, unfortunetly, something that can't be fixed, because it would cause breaking changes to backward compatible behavior.  User comments like "This is why I don't use timeline's anymore." are evidence of this.