# Detect flash lose focus (mouse rollout swf)

**URL:** <https://forum.kirupa.com/t/detect-flash-lose-focus-mouse-rollout-swf/157102>\
**Category:** flash\
**Created:** [July 29, 2005, 9:53pm UTC](https://forum.kirupa.com/t/detect-flash-lose-focus-mouse-rollout-swf/157102 "2005-07-29T21:53:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![borispc](https://avatars.discourse-cdn.com/v4/letter/b/ac8455/32.png) [@borispc](https://forum.kirupa.com/u/borispc)\
**Post date:** [July 29, 2005, 9:53pm UTC](https://forum.kirupa.com/t/detect-flash-lose-focus-mouse-rollout-swf/157102/1 "2005-07-29T21:53:17Z")

</div>

Hello All!

I haven’t been able to figure out. Here’s the deal:

I want my flash movie to go to a specific frame when the user moves the cursor away from the actual swf file (rollout) in the html page.  
I tried different things, for instance having a big transparent movieclip in the background and use hitTest:

//this code is in the root level

this.createEmptyMovieClip(‘penCheck’, 100000);  
this.penCheck.ref = this;  
this.penCheck.onEnterFrame = function() {  
var hit = this.ref.stageArea.hitTest(\_root.\_xmouse, \_root.\_ymouse, true);  
if (!hit) {  
this.ref.gotoAndPlay(“rollout”);  
}  
};

This doesn’t work until the user clicks outside the flash (flash loses focus).  
PS: No Javascript allowed. Just AS.  
Any ideas?
