• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1045
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

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