Skip to main content
Participant
February 7, 2009
Answered

Scrolling Movie Problem

  • February 7, 2009
  • 1 reply
  • 257 views
Once again I'd like to thank SwapnilVJ for help in my previous post.

I now have my movie scrolling without errors.

I only want it to scroll so far. I have set the limits and it stops exactly where I want it to. - No Problem.

Problem is: If I don't get to the upper and lower scroll limit, it works as it should - scrolling both up and down. Once it gets to the scroll limit, it stops as it is supposed to but it will not start back up to scroll in the oposite direction.

I realize that I have set the speed to speed = speed *0 (to stop the scrolling) but I do not know what to put to get it to start scrolling in the opposite direction once a button is pushed again.

My code is:

//scroll buttons

//up button

upArrow.addEventListener(MouseEvent.MOUSE_DOWN , scrollDownPress);

function scrollDownPress(event:MouseEvent):void
{
btn_movie.addEventListener(Event.ENTER_FRAME , btn_movieScrollDown);

}

upArrow.addEventListener(MouseEvent.MOUSE_UP , scrollDownRelease);

function scrollDownRelease(event:MouseEvent):void
{
btn_movie.removeEventListener(Event.ENTER_FRAME , btn_movieScrollDown);

}

upArrow.addEventListener(MouseEvent.ROLL_OVER , scrollDownRollOver);

function scrollDownRollOver(event:MouseEvent):void
{
upArrow.gotoAndStop(2);

}

upArrow.addEventListener(MouseEvent.ROLL_OUT , scrollDownRollOut);

function scrollDownRollOut(event:MouseEvent):void
{
upArrow.gotoAndStop(1);

}

//down button

downArrow.addEventListener(MouseEvent.MOUSE_DOWN , scrollUpPress);

function scrollUpPress(event:MouseEvent):void
{
btn_movie.addEventListener(Event.ENTER_FRAME , btn_movieScrollUp);

}

downArrow.addEventListener(MouseEvent.MOUSE_UP , scrollUpRelease);

function scrollUpRelease(event:MouseEvent):void
{
btn_movie.removeEventListener(Event.ENTER_FRAME , btn_movieScrollUp);

}

downArrow.addEventListener(MouseEvent.ROLL_OVER , scrollUpRollOver);

function scrollUpRollOver(event:MouseEvent):void
{
downArrow.gotoAndStop(2);

}

downArrow.addEventListener(MouseEvent.ROLL_OUT , scrollUpRollOut);

function scrollUpRollOut(event:MouseEvent):void
{
downArrow.gotoAndStop(1);

}



//Scrolling Buttons

var speed:Number = 3;

//Scroll Up

//btn_movie.addEventListener(Event.ENTER_FRAME , btn_movieScrollUp);
function btn_movieScrollUp(event:Event):void
{
btn_movie.y = btn_movie.y - speed;

if (btn_movie.y < -142){
speed = speed* 0;
}
}

//Scroll Down

//btn_movie.addEventListener(Event.ENTER_FRAME , btn_movieScrollDown);
function btn_movieScrollDown(event:Event):void
{
btn_movie.y = btn_movie.y + speed;

if (btn_movie.y > 0){
speed = speed* 0;
}
}

Thanks in advance for any help
This topic has been closed for replies.
Correct answer TimRice2010
I figured it out.

Revised code below:

//Scrolling Buttons


var speed:Number = 3;

//Scroll Up

function btn_movieScrollUp(event:Event):void
{
btn_movie.y = btn_movie.y - speed;

if (btn_movie.y < -142){
speed = 0;
}
if (btn_movie.y > -142){
speed = 3;
}

}

//Scroll Down


function btn_movieScrollDown(event:Event):void
{
btn_movie.y = btn_movie.y + speed;

if (btn_movie.y > 0){
speed = 0;
}
if (btn_movie.y < 0){
speed = 3;
}

}

1 reply

Participant
February 7, 2009
Maybe I should also mention that I do not have a scroll track. I am using just an up arrow and a down arrow for this.
TimRice2010AuthorCorrect answer
Participant
February 8, 2009
I figured it out.

Revised code below:

//Scrolling Buttons


var speed:Number = 3;

//Scroll Up

function btn_movieScrollUp(event:Event):void
{
btn_movie.y = btn_movie.y - speed;

if (btn_movie.y < -142){
speed = 0;
}
if (btn_movie.y > -142){
speed = 3;
}

}

//Scroll Down


function btn_movieScrollDown(event:Event):void
{
btn_movie.y = btn_movie.y + speed;

if (btn_movie.y > 0){
speed = 0;
}
if (btn_movie.y < 0){
speed = 3;
}

}