views:

64

answers:

3

Hi guys..

I am trying to scroll a movieclip with a scroll bar....I have tried ULscrollBar but it ends up only works for text...

Are there anyway to scroll MC by using only AS3 in flex environment...? Thanks.

+1  A: 

check this page: http://www.gotoandlearn.com/index.php?currentpage=6

PatrickS
+1  A: 

I honestly don't know what Flex can and can't do, but what I do in Flash is

stage.addEventListener (MouseEvent.MOUSEWHEEL, MouseWheel, false, 0, true);
function MouseWheel (e:MouseEvent) {
  if (e.delta > 0) {
    mc.y += 10;
  } else {
    mc.y -= 10;
  }
}

The MOUSEWHEEL listener runs everytime the mouse wheel is moved up or down. The delta tells you whether the mouse wheel went up or down. It can either be negative or positive, I don't remember whether negative is when the wheel goes up or when it goes down, same with positive.

Or you can add 2 buttons, one that scrolls up when you click it and one that scrolls down.

TreeTree
Unless something has changed when I wasn't looking, the OS X Flash Player is not guaranteed to receive mouse wheel events and JavaScript must forward them to Flash.
Tegeril
A: 
  • Make sure your movie clip is exported for actionscript
  • Drag a new scrollPane component to the stage
  • Skin the scrollbars and the background if you need to
  • Create a new instance of your movie clip programmatically
  • Set the source property of the scrollPane to your movie clip
  • This took 2 minutes, less then you expected, so reward yourself with a cup of coffee
R. Haluk Öngör