A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] How to scroll only if the cursor is above the scroll area?

  1. #1
    Member
    Join Date
    Jul 2008
    Posts
    73

    resolved [RESOLVED] How to scroll only if the cursor is above the scroll area?

    I've got a scrolling thumbnail bar that I want to activate only when the cursor is above the thumbnail bar. At the moment it will also scroll if the cursor's away from the thumnails.

    How could I do this? I've tried using on rollOver but it's not continuous. The code at the moment is

    Code:
    function scrolling() {
    	_root.onEnterFrame = function() {
    		container_mc._x-= (mask_mc._xmouse-(mask_mc._width/2-(mask_mc._width/4)*(mask_mc._xmouse<mask_mc._width/2)+(mask_mc._width/4)*(mask_mc._xmouse>mask_mc._width/2)))*(Math.abs(mask_mc._xmouse-mask_mc._width/2)>mask_mc._width/4)*1/10; 
    		if (container_mc._x>mask_mc._x) {
    			container_mc._x = mask_mc._x;
    		}
    		if (container_mc._x<(mask_mc._x-(container_mc._width-mask_mc._width))) {
    			container_mc._x = mask_mc._x-(container_mc._width-mask_mc._width);
    		}
    	};
    }

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    try an if statement:

    if (container_mc.hitTest(_root._xmouse, _root._ymouse, true)) {
    //actions
    }

    gparis

  3. #3
    Member
    Join Date
    Jul 2008
    Posts
    73
    Yeah that did it. Thanks a lot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center