[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1040
  • Last Modified:

How to change parent/child relationships of existing objects

Is there a way to change relationships of objects in action Script 3.0?
lets say you have 4 object on the screen - Box 1 , Box2, Circle1 and Circle2
Circle 1 is a child of Box1
Circle2 is a child of Box 2
Now I want Circle2 to switch parents, so that is is a child of box1, effectively changing the path I have to take to reference it.  Instead of referencing Circle2 as Box2.Circle2  it is Box1.Circle2.
0
cakepizza
Asked:
cakepizza
1 Solution
 
CyanBlueCommented:
You could try reparenting by using addChild() function like this...

Box1.addChild(Box2.Circle2);

CyanBlue
0
 
cakepizzaAuthor Commented:
Just needed 1 little tweek.

Box1.Circle2=Box1.addChild(Box2.Circle2);

Sweet.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now