mouse position sensitive scrolling

  • plecks
  • Novice
  • Novice
  • plecks
  • Posts: 20

Post 3+ Months Ago

i saw an effect that i thought was rather neat on

http://www.revoltrevolt.com

where in there is a slideshow whose scrolling direction and velocity is determined by the position of the mouse.

how is this accomplished?

thanks in advance for your insight.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Tchuki
  • Mastermind
  • Mastermind
  • Tchuki
  • Posts: 1774
  • Loc: Edinburgh

Post 3+ Months Ago

http://www.kirupa.com/developer/mx/infinite.htm

Not exactly the same but the basic principles are all correct.

**You may want to look into changing your avatar. Not sure if the Mod/Admin team will take kindly to it. Just a thought.**
  • plecks
  • Novice
  • Novice
  • plecks
  • Posts: 20

Post 3+ Months Ago

thanks for the link. i'll check it out! Image



(and the heads up) i'm the type of person who likes to push boundaries. i would be deeply sorrowful should the moderators of this board see fit to regulate my ability to express myself how i see fit (so long as it is not immediately threatening or offensive towards any one individual or people group). my freedom of expression is important to me, and yours should be to you. i hope you understand.
  • plecks
  • Novice
  • Novice
  • plecks
  • Posts: 20

Post 3+ Months Ago

i'm loving the infinite scrolling (loop) menu option, but i was wondering this one thing:

how would i go about telling the window to stop scrolling (with an ease) once the mouse _y position has gone above or below the scrolling menu?

here is the code i'm using, at the moment:

Code: [ Select ]
onClipEvent (load)
{
  xcenter=400;
  speed=1/50;
}
onClipEvent (enterFrame)
{
  var distance=_root._xmouse-xcenter;
  _x+=(distance*speed);
  if (_x > 0) _x=-904;
  if (_x < -904) _x=0;
}
  1. onClipEvent (load)
  2. {
  3.   xcenter=400;
  4.   speed=1/50;
  5. }
  6. onClipEvent (enterFrame)
  7. {
  8.   var distance=_root._xmouse-xcenter;
  9.   _x+=(distance*speed);
  10.   if (_x > 0) _x=-904;
  11.   if (_x < -904) _x=0;
  12. }


thank you in advance for any assistance.

-db
  • Tchuki
  • Mastermind
  • Mastermind
  • Tchuki
  • Posts: 1774
  • Loc: Edinburgh

Post 3+ Months Ago

http://www.kirupa.com/developer/mx/followease.htm

^^ Use a combination of that and a hitTest to see if the cursor is over the movie at all.
  • plecks
  • Novice
  • Novice
  • plecks
  • Posts: 20

Post 3+ Months Ago

i don't follow.

:oops:

sorry, although i recognize the hitTest function, i'm not familiar with it's usage. macromedia's actionscript dictionary isn't of much service either, i'm afraid. can you prescribe an informative source on the appropriate usage of that function? it looks like hit test will assign a mouseover function, but how do i accomplish an inverse reaction? (ie. stop scrolling when hitTest returns a (false?) result?) i'm not sure what the return is on the hitTest function.

thank you for your time and attention.

-db
  • roarmeow
  • Professor
  • Professor
  • User avatar
  • Posts: 861
  • Loc: BKNY

Post 3+ Months Ago

hitTest returns a true/false statement...
i believe that's called 'boolean' or something... but i always thought that was a cheap way to make soup stock...

anyways... one way you can use it is for an if statement, such as
Code: [ Select ]
if (hitTest( _root._xmouse, _root._ymouse, true)){
blah blah blah}
  1. if (hitTest( _root._xmouse, _root._ymouse, true)){
  2. blah blah blah}
  • Tchuki
  • Mastermind
  • Mastermind
  • Tchuki
  • Posts: 1774
  • Loc: Edinburgh

Post 3+ Months Ago

TRUE & FALSE are boolean values as roarmeow has already stated.

What you need to do is incorporate that hitTest into your original script:

Code: [ Select ]
onClipEvent (load)
{
  xcenter=400;
  speed=1/50;
  _x = 0;
  _y = 0;
  speedOut = 5;
}
onClipEvent (enterFrame)
{
if(this.hitTest (_root.xmouse, _root.ymouse, true) {
  var distance=_root._xmouse-xcenter;
  _x+=(distance*speed);
  if (_x > 0) _x=-904;
  if (_x < -904) _x=0;
} else {
  endX = _root._xmouse;
  endY = _root._ymouse;
  _x += (endX-_x)/speedOut;
  _y += (endY-_y)/speedOut;
}
}
  1. onClipEvent (load)
  2. {
  3.   xcenter=400;
  4.   speed=1/50;
  5.   _x = 0;
  6.   _y = 0;
  7.   speedOut = 5;
  8. }
  9. onClipEvent (enterFrame)
  10. {
  11. if(this.hitTest (_root.xmouse, _root.ymouse, true) {
  12.   var distance=_root._xmouse-xcenter;
  13.   _x+=(distance*speed);
  14.   if (_x > 0) _x=-904;
  15.   if (_x < -904) _x=0;
  16. } else {
  17.   endX = _root._xmouse;
  18.   endY = _root._ymouse;
  19.   _x += (endX-_x)/speedOut;
  20.   _y += (endY-_y)/speedOut;
  21. }
  22. }


Not sure if that will work and unable to test it at the moment but thats the basic principle.

Post Information

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