# Stage mouse\_out function error

**URL:** <https://forum.kirupa.com/t/stage-mouse-out-function-error/307426>\
**Category:** flash\
**Created:** [April 3, 2010, 2:09am UTC](https://forum.kirupa.com/t/stage-mouse-out-function-error/307426 "2010-04-03T02:09:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jameslittle2104](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@jameslittle2104](https://forum.kirupa.com/u/jameslittle2104)\
**Post date:** [April 3, 2010, 2:09am UTC](https://forum.kirupa.com/t/stage-mouse-out-function-error/307426/1 "2010-04-03T02:09:42Z")

</div>

Hi guys.

I’ve added a MOUSE\_OUT event listener to the stage on a Flash app. The problem is that the function runs on mouse\_out of the buttons on the stage, even if the mouse is still on the stage.

Code…

//\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* PUBLIC PROPERTIES \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
//\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
var grStart:Number = 228;  
var prStart:Number = 457;  
var ppStart:Number = 686;  
var intSt:Number = 35;  
var ecomSt:Number = 35;  
var dataSt:Number = 60;  
var mainSt:Number = 70;  
var seoSt:Number = 100;  
var mobSt:Number = 120;  
var entFrObj:MovieClip = new MovieClip();  
//\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* CONSTRUCTOR \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
//\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
this.webDesign\_bt.addEventListener(MouseEvent.MOUSE\_OVER, webHover);  
this.addChild(entFrObj);  
stage.addEventListener(MouseEvent.MOUSE\_OUT, resetMovs);

//\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* METHODS \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
//\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_

//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Web design HOVER functions \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
function webHover(e:Event):void {  
this.entFrObj.addEventListener(Event.ENTER\_FRAME, webMoveOut);  
}  
function webMoveOut(e:Event):void {

var grHideFinal:Number = 457;  
var prHideFinal:Number = 572;

var intFn:Number = 128;  
var ecomFn:Number = 256;  
var dataFn:Number = 384;  
var mainFn:Number = 512;  
var seoFn:Number = 640;  
var mobFn:Number = 768;

this.graphicDesign\_mc.x += Math.ceil((grHideFinal - this.graphicDesign\_mc.x) / 4);  
this.production\_mc.x += Math.ceil((prHideFinal - this.production\_mc.x) / 4);

this.webIcons\_mc.inter\_mc.x += Math.ceil((intFn - this.webIcons\_mc.inter\_mc.x) / 3);  
this.webIcons\_mc.ecomm\_mc.x += Math.ceil((ecomFn - this.webIcons\_mc.ecomm\_mc.x) / 3);  
this.webIcons\_mc.data\_mc.x += Math.ceil((dataFn - this.webIcons\_mc.data\_mc.x) / 3);  
this.webIcons\_mc.maint\_mc.x += Math.ceil((mainFn - this.webIcons\_mc.maint\_mc.x) / 3);  
this.webIcons\_mc.seo\_mc.x += Math.ceil((seoFn - this.webIcons\_mc.seo\_mc.x) / 3);  
this.webIcons\_mc.mobile\_mc.x += Math.ceil((mobFn - this.webIcons\_mc.mobile\_mc.x) / 3);

if (this.graphicDesign\_mc.x == grHideFinal){  
this.entFrObj.removeEventListener(Event.ENTER\_FRAME, webMoveOut);  
this.graphicDesign\_mc.x = grHideFinal;  
this.production\_mc.x = prHideFinal;  
}

}

//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Stage reset functions \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
function resetMovs(e:Event):void {  
this.entFrObj.removeEventListener(Event.ENTER\_FRAME, webMoveOut);  
this.entFrObj.addEventListener(Event.ENTER\_FRAME, resetMov);  
}  
function resetMov(e:Event):void {

this.webIcons\_mc.inter\_mc.x -= (this.webIcons\_mc.inter\_mc.x - intSt) / 3;  
this.webIcons\_mc.ecomm\_mc.x -= (this.webIcons\_mc.ecomm\_mc.x - ecomSt) / 3;  
this.webIcons\_mc.data\_mc.x -= (this.webIcons\_mc.data\_mc.x - dataSt) / 3;  
this.webIcons\_mc.maint\_mc.x -= (this.webIcons\_mc.maint\_mc.x - mainSt) / 3;  
this.webIcons\_mc.seo\_mc.x -= (this.webIcons\_mc.seo\_mc.x - seoSt) / 3;  
this.webIcons\_mc.mobile\_mc.x -= (this.webIcons\_mc.mobile\_mc.x - mobSt) / 3;

if(this.graphicDesign\_mc.x \< grStart){  
this.graphicDesign\_mc.x += Math.ceil((grStart - this.graphicDesign\_mc.x) / 4);  
}else if(this.graphicDesign\_mc.x \> grStart){  
this.graphicDesign\_mc.x -= Math.ceil((this.graphicDesign\_mc.x - grStart) / 4);  
}

if(this.production\_mc.x \< prStart){  
this.production\_mc.x += Math.ceil((prStart - this.production\_mc.x) / 4);  
}else if(this.production\_mc.x \> prStart){  
this.production\_mc.x -= Math.ceil((this.production\_mc.x - prStart) / 4);  
}

if(this.graphicDesign\_mc.x == grStart && this.production\_mc.x == prStart){  
this.entFrObj.removeEventListener(Event.ENTER\_FRAME, resetMov);  
this.webIcons\_mc.inter\_mc.x = 35;  
this.webIcons\_mc.ecomm\_mc.x = 35;  
this.webIcons\_mc.data\_mc.x = 60;  
this.webIcons\_mc.maint\_mc.x = 70;  
this.webIcons\_mc.seo\_mc.x = 100;  
this.webIcons\_mc.mobile\_mc.x = 120;  
}  
}
