Help! Stopping a rolling thumnail scroller!

  • jumbola
  • Born
  • Born
  • jumbola
  • Posts: 3

Post 3+ Months Ago

<--------------------------------

panel.onRollOver = panelOver;

function panelOver() {
this.onEnterFrame = scrollPanel;
delete this.onRollOver;
}

var b = stroke.getBounds(_root);

function scrollPanel() {
if(_xmouse<b.xMin || _xmouse>b.xMax || _ymouse<b.yMin || _ymouse>b.yMax) {
this.onRollOver = panelOver;
delete this.onEnterFrame;

}

if (panel._x >=-60) {
panel._x =-60;
}

if (panel._x <=-1100) {
panel._x =-1100;
}

var xdist = _xmouse - 400;

panel._x += -xdist / 25;


}

<--------------------------------

Any thoughts at all?

Desperately need to sort asap
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

great, another site that's not working.
well, the basic idea is this. Place your gallery and mask it with a movieclip called mask. Then, depending on mouse position, you scroll the movie called timemovie.
Code: [ Select ]
border = 15;
var nMargin = 0;
function SetVariables(nWidth)
{
    timemovie._x = - (nWidth) / 2;
    nMargin = mask._x = (nWidth - mask._width) / 2;
    iWidth = nWidth;
    center = nWidth / 2;
    moviePos = 5;
    Leftstop = mask._x - border;
    Rightstop = mask._x + mask._width + border;
    Upstop = mask._y;
    Downstop = mask._y + mask._height;
    trace("ls="+Leftstop+";rs="+Rightstop);
}
this.onEnterFrame = function()
{
    if (_xmouse > Leftstop && _xmouse < Rightstop && _ymouse > Upstop && _ymouse < Downstop)
    {
        ScrollSpeed = (_xmouse - center) / 20;
        moviePos = Math.round(moviePos - ScrollSpeed);
    } // end if
    if (moviePos < -nMargin)
    {
        moviePos = -nMargin;
    } // end if
    if (moviePos > nMargin + 11 )
    {
        moviePos = nMargin + 11;
    } // end if
    timemovie._x = moviePos;
}

SetVariables(timemovie._width);
stop();
  1. border = 15;
  2. var nMargin = 0;
  3. function SetVariables(nWidth)
  4. {
  5.     timemovie._x = - (nWidth) / 2;
  6.     nMargin = mask._x = (nWidth - mask._width) / 2;
  7.     iWidth = nWidth;
  8.     center = nWidth / 2;
  9.     moviePos = 5;
  10.     Leftstop = mask._x - border;
  11.     Rightstop = mask._x + mask._width + border;
  12.     Upstop = mask._y;
  13.     Downstop = mask._y + mask._height;
  14.     trace("ls="+Leftstop+";rs="+Rightstop);
  15. }
  16. this.onEnterFrame = function()
  17. {
  18.     if (_xmouse > Leftstop && _xmouse < Rightstop && _ymouse > Upstop && _ymouse < Downstop)
  19.     {
  20.         ScrollSpeed = (_xmouse - center) / 20;
  21.         moviePos = Math.round(moviePos - ScrollSpeed);
  22.     } // end if
  23.     if (moviePos < -nMargin)
  24.     {
  25.         moviePos = -nMargin;
  26.     } // end if
  27.     if (moviePos > nMargin + 11 )
  28.     {
  29.         moviePos = nMargin + 11;
  30.     } // end if
  31.     timemovie._x = moviePos;
  32. }
  33. SetVariables(timemovie._width);
  34. stop();
  • jumbola
  • Born
  • Born
  • jumbola
  • Posts: 3

Post 3+ Months Ago

ooh thanks. I'll try it.. I'm not too sure if I understand... but I'll have a go! :)
  • dann_the_van
  • Novice
  • Novice
  • dann_the_van
  • Posts: 23
  • Loc: South Wales, UK

Post 3+ Months Ago

A nice example of creating borders for scrolling content...

im using the _x & _y of mouse to do stuff like this, but not to this extent.

will recall this again, soon!
Danny
  • jumbola
  • Born
  • Born
  • jumbola
  • Posts: 3

Post 3+ Months Ago

hm
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

you shouldn't use neither onRollOver nor onRollOut, because you may want to add this functionality to the images that you're scrolling ... which you already do. It's ok so far, all you need is to stop the scrolling when the mouse is outside the panel which masks the pictures. Show me the code that you have so i can point you in the right direction.

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 5 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.