# Scroll MovieClip through Mouse Scroll

**URL:** <https://forum.kirupa.com/t/scroll-movieclip-through-mouse-scroll/320538>\
**Category:** flash\
**Created:** [March 26, 2011, 10:39am UTC](https://forum.kirupa.com/t/scroll-movieclip-through-mouse-scroll/320538 "2011-03-26T10:39:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sivaraj](https://avatars.discourse-cdn.com/v4/letter/s/c77e96/32.png) [@Sivaraj](https://forum.kirupa.com/u/Sivaraj)\
**Post date:** [March 26, 2011, 10:39am UTC](https://forum.kirupa.com/t/scroll-movieclip-through-mouse-scroll/320538/1 "2011-03-26T10:39:03Z")

</div>

Hi Friend,  
I have just wrote a code for vertical scroll of image through mouse scrolling…  
It works… but It works only after click on the image or inner space of the window… How i overcome this problem…  
My code is Here…

var obj:Object = new Object(img);  
var over:Boolean = false;  
var lim:Number = 0 - (img.\_height - Stage.height);

onEnterFrame = function()  
{  
img.onRollOver = function()  
{  
over = true;  
}  
img.onRollOut = function()  
{  
over = false;  
}  
}

obj.onMouseWheel = function(delta)  
{  
if(over)  
{  
if(img.\_y \<= 0 && img.\_y \>= lim)  
{

```
		img._y += 10 * delta;
		if(img._y &gt; 0)
		{
			img._y = 0;
		}
		if(img._y &lt; lim)
		{
			 img._y = lim;
		}
	}
}

```

};  
Mouse.addListener(obj);

Any friend help me…  
Thanks in advance…:thumb2:
