# Mask effect via mouse

**URL:** <https://forum.kirupa.com/t/mask-effect-via-mouse/185422>\
**Category:** Uncategorized\
**Created:** [April 13, 2006, 9:18am UTC](https://forum.kirupa.com/t/mask-effect-via-mouse/185422 "2006-04-13T09:18:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tekoer](https://avatars.discourse-cdn.com/v4/letter/t/ecccb3/32.png) [@tekoer](https://forum.kirupa.com/u/tekoer)\
**Post date:** [April 13, 2006, 9:18am UTC](https://forum.kirupa.com/t/mask-effect-via-mouse/185422/1 "2006-04-13T09:18:44Z")

</div>

I have 2 photos, and i want to animate the first photo, so that when i move my mouse left to right the first pictures moves and the other one reveals. I have attached an example of what i am trying to achieve. So i want to move my mouse over the picture and uveal the photo under it. I hope you understand.  
Thanks

---

<div class="post-metadata">

**Author:** ![sriindira](https://avatars.discourse-cdn.com/v4/letter/s/ee59a6/32.png) [@sriindira](https://forum.kirupa.com/u/sriindira)\
**Post date:** [April 13, 2006, 9:54am UTC](https://forum.kirupa.com/t/mask-effect-via-mouse/185422/2 "2006-04-13T09:54:22Z")

</div>

onClipEvent(enterFrame){  
if(this.\_x\<\_root.\_xmouse-100)this.\_x+=5;  
if(this.\_x\>300)this.\_x=this.\_x;  
}

u can use this code the first one ensures that if the movie clips pos is less that mouse it will increment itself and follow the mouse again if u move the mouse it will be incremented but it cant go beyond the stage which is ensured by the second line (300 is your movie width)

Hope this helps…

---

<div class="post-metadata">

**Author:** ![tekoer](https://avatars.discourse-cdn.com/v4/letter/t/ecccb3/32.png) [@tekoer](https://forum.kirupa.com/u/tekoer)\
**Post date:** [April 16, 2006, 1:46am UTC](https://forum.kirupa.com/t/mask-effect-via-mouse/185422/3 "2006-04-16T01:46:53Z")

</div>

> [@sriindira](#):
>
> onClipEvent(enterFrame){  
> if(this.\_x\<\_root.\_xmouse-100)this.\_x+=5;  
> if(this.\_x\>300)this.\_x=this.\_x;  
> }
> 
> u can use this code the first one ensures that if the movie clips pos is less that mouse it will increment itself and follow the mouse again if u move the mouse it will be incremented but it cant go beyond the stage which is ensured by the second line (300 is your movie width)
> 
> Hope this helps…

I don’t really understand, do i paste this code on the mask?v or on the photo I want to mask?

---

<div class="post-metadata">

**Author:** ![icleric](https://avatars.discourse-cdn.com/v4/letter/i/4bbf92/32.png) [@icleric](https://forum.kirupa.com/u/icleric)\
**Post date:** [April 16, 2006, 10:34am UTC](https://forum.kirupa.com/t/mask-effect-via-mouse/185422/4 "2006-04-16T10:34:59Z")

</div>

post the fla and i’ll hook it up for you =)

---

<div class="post-metadata">

**Author:** ![tekoer](https://avatars.discourse-cdn.com/v4/letter/t/ecccb3/32.png) [@tekoer](https://forum.kirupa.com/u/tekoer)\
**Post date:** [April 17, 2006, 11:36am UTC](https://forum.kirupa.com/t/mask-effect-via-mouse/185422/5 "2006-04-17T11:36:48Z")

</div>

I cant really post the fla because it is larger than 72kb. Could you just draw 2 squares instead of the photos to show. The principle is the same.  
Thanks
