Solved

Mouse activated scrolling navigation in Flash MX

Posted on 2006-07-13
2
238 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 400 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
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 how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

696 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