# Continuous zooming onPress of button

**URL:** <https://forum.kirupa.com/t/continuous-zooming-onpress-of-button/280595>\
**Category:** flash\
**Created:** [January 29, 2009, 7:59am UTC](https://forum.kirupa.com/t/continuous-zooming-onpress-of-button/280595 "2009-01-29T07:59:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bugsmillionaire](https://avatars.discourse-cdn.com/v4/letter/b/e47774/32.png) [@bugsmillionaire](https://forum.kirupa.com/u/bugsmillionaire)\
**Post date:** [January 29, 2009, 7:59am UTC](https://forum.kirupa.com/t/continuous-zooming-onpress-of-button/280595/1 "2009-01-29T07:59:29Z")

</div>

Problem:  
I have created a buttons with setInterval so that it can call the function till the button will be pressed.

onRelease of button I 'm clearing the interval.

It is working fine.

It gives problem when I’m pressing a button and moving the cursor out of that button area and releasing, it does not call the onRelease event and hence the function goes in the infinite loop.

\_level0.main.btn\_SizePlus.onPress = function()  
{  
if(plusint != null)  
{  
clearInterval(plusint);  
}  
plusint = setInterval(SizePlus,20);  
};

\_level0.main.btn\_SizePlus.onRelease = function()  
{  
clearInterval(plusint);  
};

Please help!!
