Below is what I’m doing, But I need to add a “close” button that will move the tabBtn back. And also replay the video?
tabBtn.addEventListener(MouseEvent.CLICK, buttonClickHandler);
function buttonClickHandler(event:MouseEvent):void {
videoPlayer.stop();
}
// start the animation when tabBtn is clicked
tabBtn.addEventListener(MouseEvent.CLICK, moveTo);
var currentFrameCount:int;
var totalFrameCount:int = 20;
var destinationX:Number = 302;
var destinationY:Number = 100;
var initialX:Number;
var initialY:Number;
var distanceX:Number;
var distanceY:Number;
function moveTo (evt:MouseEvent):void
{
currentFrameCount = 0;
initialX = tabBtn.x;
initialY = tabBtn.y;
distanceX = destinationX - initialX;
distanceY = destinationY - initialY;
tabBtn.addEventListener(Event.ENTER_FRAME, animateMoveTo);
}
function animateMoveTo (evt:Event):void
{
currentFrameCount++;
if (currentFrameCount < totalFrameCount){
var progress:Number = currentFrameCount/totalFrameCount;
tabBtn.x = initialX + distanceX*progress;
tabBtn.y = initialY + distanceY*progress;
}else{
tabBtn.x = destinationX;
tabBtn.y = destinationY;
tabBtn.removeEventListener(Event.ENTER_FRAME, animateMoveTo);
}
}