brown22
December 27th, 2009, 10:03 PM
Hi everybody,
Is it possible to make a navigation bar appear at the bottom screen of a flash movie only when the user moves the mouse. And also make it disappear after 5 seconds if the mouse doesn't move.
Brown
snickelfritz
December 27th, 2009, 10:23 PM
Use the timer class for this.
import com.greensock.*;
nav.alpha = 0;
stage.addEventListener(MouseEvent.MOUSE_MOVE, showNav);
var timer:Timer = new Timer(5000, 1);
timer.addEventListener(TimerEvent.TIMER, hideNav);
function showNav(e:MouseEvent):void
{
timer.start();
TweenLite.to(nav, 1, {alpha:1, onStart:stopListener});
}
function hideNav(e:TimerEvent):void
{
timer.stop();
TweenLite.to(nav, 1, {alpha:0, onComplete:startListener});
}
function startListener():void
{
stage.addEventListener(MouseEvent.MOUSE_MOVE, showNav);
}
function stopListener():void
{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, showNav);
}
brown22
December 28th, 2009, 10:26 AM
Thanks,
I'll give it a try and see if it works...
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.