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;
}
}