I’m trying to create a sort of tree diagram, in which the most recent branch of the tree has 100% opacity, and each recurrent branch of the tree has its opacity reduced by 75%. I’m applying the opacity change to each branch’s containing movie clip – the actual graphical elements (all drawn with Flash’s graphics.line and graphics.shape commands) are added to this container as child elements. However, changing the opacity of the container doesn’t seem to affect the actual graphical elements contained within. How do I accomplish this? Here’s a rough outline of what’s happening:
Nesting Order:
var circle:Shape = new Shape();
var circleClip:MovieClip = new MovieClip();
var childHolder:MovieClip = new MovieClip();
var circleHolder:MovieClip = new MovieClip();
circleClip.addChild(circle);
circleHolder.addChildAt(circleClip,0);
circleHolder.addChildAt(childHolder,1);
On Click of circleHolder, I create a new branch, attach it to the child holder, and move
it, drawing a line to wherever it moves to:
childHolder.addChild(newCircle);
newCircle.moveTo(x,y);
What I want to do is now reduce the opacity of the parent. I’m doing this through this sort of equation:
private function fadeParents(circleHolderRef)
{
var curCircleHolderRef = circleHolderRef;
var curOpacity = 1;
var circleDepth = circleHolderRef.depthFromStart;
for (var i=0;i<circleDepth;i++)
{
var childHolderRef = curCircleHolderRef.parent;
var parentCircleHolderRef = childHolderRef.parent;
curOpacity = curOpacity * .75;
trace (i + "| opacity: " + curOpacity);
TweenMax.to(parentCircleHolderRef,.5,{opacity: curOpacity});
curCircleHolderRef = parentCircleHolderRef;
}
//trace (circleHolderRef.depthFromStart)
}
but this is having no effect.
You are tweening a property named
opacity, this should throw errors, MovieClip transparency is set withalpha: