Help! Stopping a rolling thumnail scroller!

  • jumbola
  • Born
  • Born
  • No Avatar
  • Joined: Feb 26, 2007
  • Posts: 3
  • Status: Offline

Post February 26th, 2007, 11:22 am

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

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
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post February 26th, 2007, 11:22 am

  • IceCold
  • Guru
  • Guru
  • User avatar
  • Joined: Nov 05, 2004
  • Posts: 1254
  • Loc: Ro
  • Status: Offline

Post February 27th, 2007, 1:20 am

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();
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
  • jumbola
  • Born
  • Born
  • No Avatar
  • Joined: Feb 26, 2007
  • Posts: 3
  • Status: Offline

Post February 27th, 2007, 1:43 am

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
  • No Avatar
  • Joined: Feb 22, 2007
  • Posts: 23
  • Loc: South Wales, UK
  • Status: Offline

Post February 27th, 2007, 7:32 am

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
  • No Avatar
  • Joined: Feb 26, 2007
  • Posts: 3
  • Status: Offline

Post February 28th, 2007, 5:43 pm

hm
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Joined: Nov 05, 2004
  • Posts: 1254
  • Loc: Ro
  • Status: Offline

Post February 28th, 2007, 10:34 pm

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.
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 31 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
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.