I’m italian, so sorry for my english.
I’m working on my new website, and in a section of it I want a scroll button with ease effect.
You can see an example WITHOUT ease effect on the following link:
http://www.chaosmonger.com/chaos08_video.html
Made with this code:
btnUp.addEventListener(MouseEvent.MOUSE_OVER, BUTUP);
btnUp.addEventListener(MouseEvent.MOUSE_OUT, stopBUTUP);
btnDown.addEventListener(MouseEvent.MOUSE_OVER, BUTDOWN);
btnDown.addEventListener(MouseEvent.MOUSE_OUT, stopBUTDOWN);
btnUp.addEventListener(Event.ENTER_FRAME, BUTUP);
btnDown.addEventListener(Event.ENTER_FRAME, BUTDOWN);
contentMain.addEventListener(Event.ENTER_FRAME, skrolldown);
contentMain.addEventListener(Event.ENTER_FRAME, skrollup);
var scrolldown:Boolean=false;
var scrollup:Boolean=false;
import flash.events.Event;
var scrollHeight:Number = 460;
var contentHeight:Number = contentMain.height;
var maskHeight:Number = maskedView.height;
var initContentPos:Number = contentMain.y;
var finalContentPos:Number = maskHeight-contentHeight+initContentPos;
var speed:Number = 5;
function BUTUP(event:MouseEvent):void
{
scrollup=true;
}
function stopBUTUP(event:MouseEvent):void
{
scrollup=false;
}
function skrollup (evt:Event):void
{
if(scrollup)
{
if (contentMain.y+speed<maskedView.y) {
btnDown.visible = true;
contentMain.y += speed;}
else {
btnUp.visible = false;
contentMain.y = maskedView.y;}
}
}
function BUTDOWN(event:MouseEvent):void
{
scrolldown=true;
}
function stopBUTDOWN(event:MouseEvent):void
{
scrolldown=false;
}
function skrolldown (evt:Event):void
{
if(scrolldown)
{
if (contentMain.y-speed>finalContentPos) {
btnUp.visible = true;
contentMain.y -= speed;}
else {
btnDown.visible = false;
contentMain.y = finalContentPos;}
}
}
if (contentMain.y==0) {
btnUp.visible = false;
}
I have two buttons (btnUp & btnDown), a movieclip that contains all the images (contentMain) and a movieclip as a mask (maskedView).
I need an ease effect when I rollover/rollout or click the mouse, like this:
http://www.animallogic.com/#Our%20Work,Commercials
Can anybody suggest me a code to give an ease effect to buttons, without upset my original code?
THANKS A LOT!