1

I have a menu page for a book containing a scrollable parent movieclip which has 27 child movie clips.I had added key board input to scroll it.Now I have added a search button and an input text field in the menu page.Suppose user want to open part 12 or part 20 or else,s/he will write 12/20 or else in the text field and click search button then it will scroll up/down and show where that specific part 12/20 is present. I have tried to solve this using a condition that, when input to text field is given between 7 to 13 the y axis of parent clip scroll down with doublescrollstep var which is 500 and show part 7 to 12 when input is 13 to 18 y axis of parent clip scroll down with tripplescrollstep var which is 1000 and show part 13 to 18.But it is scrolling down.if i want to scroll it up What should I do? Here is my code :

pat_index.mask = mask_mov;
var goY:Number = pat_index.y;
var initY:Number = pat_index.y;
var singleScrollStep:Number = 30;
bt_slider.height = slider_lane.height / pat_index.height * mask_mov.height;
slider_lane.y +=  bt_slider.height / 2;
slider_lane.height -=  bt_slider.height;
bt_slider.y = slider_lane.y;
var sliderInitY:Number = bt_slider.y;
var sliderStepPerPercent:Number = slider_lane.height / 100;
var scrolledPercent:Number;
stage.addEventListener(Event.ENTER_FRAME, scrollManager);
function scrollManager(Event):void
{
pat_index.y += (goY - pat_index.y)/5;
scrolledPercent = ((pat_index.y-initY)*100/(mask_mov.height - pat_index.height));
bt_slider.y = sliderInitY + sliderStepPerPercent * scrolledPercent;

if (scrolledPercent > 100)
{
    goY = initY - pat_index.height + mask_mov.height;
}
if (scrolledPercent < 0)
{
    goY = initY;
}
}

inputbox.restrict="0-9";
inputbox.maxChars=3;
search.buttonMode=true;
search.addEventListener(MouseEvent.MOUSE_DOWN, searchDown);
function searchDown(event:MouseEvent):void
{
    var variable:Number;
    variable= Number(inputbox.text);
    trace(variable);
if(variable>6 && variable<13)
{
    if (pat_index.y - singleScrollStep + goY < initY - pat_index.height + mask_mov.height)
    {
        goY = initY - pat_index.height + mask_mov.height;
    }
    else
    {
        goY -=  doubleScrollStep;
    }
    /*if (pat_index.y + singleScrollStep + goY >= initY)
    {
        goY = initY;
    }
    else
    {
        goY +=  doubleScrollStep;
    }*/
}
if(variable>=13 && variable<18)
{
    if (pat_index.y - singleScrollStep + goY < initY - pat_index.height + mask_mov.height)
    {
        goY = initY - pat_index.height + mask_mov.height;
    }
    else
    {
        goY -=  trippleScrollStep;
    }
}
}}
USERRR5
  • 430
  • 2
  • 10
  • 27
  • http://www.filedropper.com/searchwithnumbr_1 this is the changed fla file,i have to scroll up and down continuously..how could i made the movie clip scroll up/down according to the input :( – USERRR5 Feb 25 '15 at 06:24

0 Answers0