• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Flash programming Question - Finding the Parent of a Circle

somehow it came up in the class, we had a parentless circle and needed
to find the parent of it.

we tried "trace(parent.circle);", something like that, no dice.

c'mon, i want my circles to know who their parents are.

anybody know (how to find the parent of a circle) ?

Moved to programming.

- Apple Mod Aphex
 
I drew a circle on frame one, converted it to a symbol called "circle", and on the frame I added trace(circle.parent); and got [object MainTimeline].

If you instantiate a Sprite and use the Graphics API to draw a circle purely in Actionscript (also on frame 1):

var spr:Sprite = new Sprite();
spr.graphics.beginFill(0x000000, 1);
spr.graphics.drawCircle(10, 10, 10);
spr.graphics.endFill();
addChild(spr);
trace(spr.parent);

It also traces to [object MainTimeline].

Is there something more specific or is that what you were going for?
 
thanks !! that helps. i asked the instructor the question and he assigned it
back to me as "extra homework". i looked in Flash help.
 
if there's no parent, it's on the display list of the main time line (AKA "root")

Sometimes when referencing root, you have to cast it as a movieclip.

MovieClip(root).myMovieClip.someProperty = someValue;
 
Back
Top