Q:

Refer to a parent movieclip with tweenLite

I have a movieclip called cerrarSumInfo inside a movieclip called SumInfo, cerrarSumInfo removes SumInfo from stage.
Code: (on the SumInfo timeline)
cerrarSumInfo.addEventListener(MouseEvent.CLICK, cerrarSum);

function cerrarSum(e:MouseEvent):void
{
        this.parent.removeChild(this);
        TweenLite.to(buscador, 0.7, {x:14, y:354.95});
}

buscador is on the main timeline, so when i test i get:

Access of undefined property buscador.

How can i reference buscador from sumInfo?
I Solved:
I solved it, all the problem was because:
this.parent.removeChild(this);
TweenLite.to(buscador, 0.7, {x:14, y:354.95});

Y was removing the child before the tween, and yes, a i reffer to buscador with:
MovieClip(root).buscador;

thanks!

A:

There a few ways you can get a reference to buscador from inside suminfo.  Here are two such ways:

use the root keyword to get a reference to the main timeline.
MovieClip(root).buscador;

Use the parent keyword:
MovieClip(parent.parent).buscador; //one parent up is cerrarSumInfo, two parents up should be the main timeline

A cleaner way would be to use events:

Take the tween out of this function:
function cerrarSum(e:MouseEvent):void
{
    this.parent.removeChild(this);
}

Then, on the main timeline:
sumInfo.addEventListener(Event.REMOVED_FROM_STAGE, sumInfoRemoved); //listen for when sumInfo is removed

function sumInfoRemoved(e:Event):void {
    TweenLite.to(buscador, 0.7, {x:14, y:354.95});
}

