Skip to main content
DigitalDesignDude
Inspiring
October 25, 2023
Question

Layer Parenting, Child Layers Not Moving with Parent Layer That's Being Moved by ActionScript

  • October 25, 2023
  • 1 reply
  • 623 views



I have a Movieclip symbol for a character and within it are multiple symbols of body parts that are linked together using Layer Parenting. 

Please see my linked .fla here if needed. I can't seem to upload it directly to the forum for some reason.


When I rotate one of the body parts such as the torso symbol using the below ActionScript 3.0 code, the torso rotates, but its linked child layers do not rotate with it.

 

 

 

MovieClip(root).character.torso.rotation = 45;

 

 

How can I get the linked layers to move along with the torso symbol which is being moved with ActionScript?



While I know a workaround would be to place all the other body part symbols inside the "torso" symbol and then rotate it, I would still like to know if layer-parented symbols can be moved with ActionScript while moving the rest of its linked layers with it.

Thank you for any input or assistance with this!

This topic has been closed for replies.

1 reply

Vladin M. Mitov
Inspiring
October 26, 2023

It seems to me that when managing instances with code, you may not be able to take advantage of the parent-child relationships between the layers simply because the concept of a "layer" exists as a convenient UI abstraction only in authoring mode.

If your project is primarily code-focused, you might consider using Bones instead of Parented layers. Please refer to the following chapters in the AS3 documentation: IKArmature, IKBone, IKEvent, IKJoint, IKManager, and IKMover.


- Vlad: UX and graphic design, Flash user since 1998Member of Flanimate Power Tools team - extensions for character animation
DigitalDesignDude
Inspiring
October 26, 2023

Thank you for your suggestion!

I typically avoid using Adobe Animate's Bones as they can be quite buggy, but it might be a better workaround than coding a tweening system that moves other linked or child symbols with a chosen parent symbol.