Hello,
Am a newbie to AS 3.0, am trying access the MainTimeLine from a movieClip instance added from Library.
Am able to remove the same instance, but am not able to navigate to MainTim
Code:
// Doesn't Work
wellPlayed(root).gotoAndStop(120);
// This removal works fine.
parent.removeChild(wellPlayed);
am sure am doing something silly here is the full code:
Code:
public class BallMc extends MovieClip
{
protected var originalPosition:Point;
public function BallMc()
{
originalPosition = new Point(x, y);
buttonMode = true;
addEventListener ( MouseEvent.MOUSE_DOWN, down );
}
protected function down (event:MouseEvent) :void
{
parent.addChild(this);
startDrag ();
stage.addEventListener ( MouseEvent.MOUSE_UP, stageUp );
}
protected function stageUp(event:MouseEvent ):void
{
stage.removeEventListener( MouseEvent.MOUSE_UP, stageUp );
stopDrag();
if( dropTarget )
{
if( dropTarget.parent.name == "basket")
{
scaleX = scaleY = 0.2;
alpha = 0.2;
y = stage.stageHeight - height - 10;
buttonMode = false;
removeEventListener( MouseEvent.MOUSE_DOWN, down );
var wellPlayed : WellPlayed = new WellPlayed();
parent.addChild(wellPlayed);
wellPlayed.x = stage.stageWidth / 2;
wellPlayed.y = stage.stageHeight / 2;
wellPlayed.addEventListener(MouseEvent.CLICK, wellClick);
function wellClick(event:MouseEvent):void
{
wellPlayed(root).gotoAndStop(120);
parent.removeChild(wellPlayed);
wellPlayed.removeEventListener(MouseEvent.CLICK, wellClick);
}
}else{
returnToOriginalPosition();
}
}else{
returnToOriginalPosition();
}
}
protected function returnToOriginalPosition():void
{
x = originalPosition.x;
y = originalPosition.y;
}
}
Someone point me in the right direction.
Thanks in advance.
Amar