If you place your contents of the movieclip so that everything is registered with the top left corner to 0,0 of the clip the following should work:

var maxMouseY:Number = mask._height;
var maxListY:Number  = maxMouseY - list._height;
onEnterFrame = function ():Void {
  if ((_ymouse < maxMouseY) && (_ymouse > 0)) {
    list._y = maxListY * (mask._ymouse/maxMouseY);
  }
};

Basically, I'm getting the mouse coords as a range from 0 to 1 (mask._ymouse/maxMouseY) where the _ymouse is located within the mask clip. 0 being the top most pixel and 1 being the bottom most.

Once I have that I multiply it by the maximum movement (maxListY) the list is allowed to move to get the scroll postion. The maximum amount the list is able to move is 0 for starting position and a negative number if it's scrolled up. The lowest negative number allowed is figured by taking the mask height and subtracting the height of the list (mask._height - list._height).


James O'Reilly  —  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train



Omar Fouad wrote:
Hey list this is my first problem i am posting here, i hope someone could
halp me!!!

i got a movie clip with inside four Key Frames... in each Key Frame i got a
mask called 'mask' (a rectangle) and a masked MC called 'list'.

than in the first layer of each keyframe (which i reserved it for
actionScript only) i put the following code:

maskY = mask._y;
maskY2 = maskY+mask._height
maskX = mask._x;
maskX2 = maskX + mask._width;
var ratio = Math.round(list._height / mask._height);

onEnterFrame = function () {
      if (_ymouse<maskY2 && _ymouse>maskY) {
      list._y = (mask._ymouse-(mask._ymouse*2))*ratio+maskY;
     }
};

it works. But it seems that the 'list' MC overscrolls as it slides up more
than it should do.
can someone help me please in resolving this ???

Regards...


_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to