[FONT=verdana, arial, helvetica][SIZE=2]Hi to all,
This is vertical xml gallery code, where the mouse will move up, then the scoller will move up and vice versa. now i want the reverse . if it move up , then the scoller come down and if it move down , then the scoller move up.
Can anyone please help me.
Thanks
[/SIZE][/FONT]
[COLOR=#000087]this[/COLOR].[COLOR=#000087]onEnterFrame[/COLOR] = [COLOR=#000087]function[/COLOR]()
{
mask_y = [COLOR=#000087]_root[/COLOR].main.verti.mask.[COLOR=#000087]_y[/COLOR];
mask_h = [COLOR=#000087]_root[/COLOR].main.verti.mask.[COLOR=#000087]_height[/COLOR];
mask_middle = (mask_y + mask_h) / 2; [COLOR=#878787]// take middle of mask as reference
[/COLOR]
roller_y = [COLOR=#000087]_root[/COLOR].main.verti.roller.[COLOR=#000087]_y[/COLOR];
roller_h = [COLOR=#000087]_root[/COLOR].main.verti.roller.[COLOR=#000087]_height[/COLOR];
ymouse = [COLOR=#000087]_root[/COLOR].main.verti.mask.[COLOR=#000087]_ymouse[/COLOR];
[COLOR=#878787]// if mous out of range
[/COLOR] [COLOR=#000087]if[/COLOR] (ymouse < mask_y || ymouse> mask_y + mask_h)
speed = 0;
[COLOR=#000087]else[/COLOR]
speed = (ymouse - mask_middle)/ 10;
[COLOR=#878787]// calculate speed -> the closer to middle-> slower, closer to edges-> faster
[/COLOR]
[COLOR=#878787]// if roller bottom reaches mask bottom and scroll up, stop
[/COLOR] [COLOR=#000087]if[/COLOR] ((roller_y+roller_h)<(mask_y+mask_h) && speed < 0)
speed = 0;
[COLOR=#878787]// if roller top reaches mask top and scroll down, stop
[/COLOR] [COLOR=#000087]if[/COLOR] (roller_y > mask_y && speed > 0)
speed = 0;
[COLOR=#000087]_root[/COLOR].main.verti.roller.[COLOR=#000087]_y[/COLOR] += speed;
}
[COLOR=#000087]stop[/COLOR]();