?
Solved

Mouse activated scrolling navigation in Flash MX

Posted on 2006-07-13
2
Medium Priority
?
239 Views
Last Modified: 2008-03-04
Hello,

I’m trying to create a vertical navigation bar that scrolls back and forth along the y axis in response to the movement of the mouse.  There is a catch, however… It can only scroll when the mouse is over the navigation.  I have other objects elsewhere on the stage that respond to mouse movements and I’ve found that it can be quite distracting to have the navigation scrolling while I navigate other parts of the stage.  


Here’s the script which is applied to the navigation mc:

onClipEvent (load)
{
   ycenter=175;
   speed=1/20;
}
onClipEvent (enterFrame)
{
   var distance=_root._ymouse-ycenter;
   _y-=(distance*speed);
   if (_y > 0) _y=-513;
   if (_y < -513) _y=0;
}

My question is, how should I modify this code so that the navigation only scrolls while the mouse is over it.

Expert assistance is always appreciated.

Thanks
0
Comment
Question by:mileHighBlogger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 23

Accepted Solution

by:
Zeffer earned 1600 total points
ID: 17104943
make the scrolling conditional on the mouse touching the movieclip..

onClipEvent (enterFrame){
      if (hitTest( _root._xmouse, _root._ymouse, false)){
      var distance=_root._ymouse-ycenter;
   _y-=(distance*speed);
   if (_y > 0) _y=-513;
   if (_y < -513) _y=0;
      }
}

Z
0
 
LVL 23

Expert Comment

by:Zeffer
ID: 17104968
and of course you could do it with a function as well..

onClipEvent (enterFrame){
this.onRollOver = function () {
var distance=_root._ymouse-ycenter;
   _y-=(distance*speed);
   if (_y > 0) _y=-513;
   if (_y < -513) _y=0;
     }
}

Z
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question