# Changing image direction in easing

**URL:** https://forum.kirupa.com/t/changing-image-direction-in-easing/260183
**Category:** flash
**Created:** [May 13, 2008, 9:38am UTC](https://forum.kirupa.com/t/changing-image-direction-in-easing/260183 "2008-05-13T09:38:06Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Natushi12](https://avatars.discourse-cdn.com/v4/letter/n/ba8739/32.png) [@Natushi12](https://forum.kirupa.com/u/Natushi12)
#### Post date: [May 13, 2008, 9:38am UTC](https://forum.kirupa.com/t/changing-image-direction-in-easing/260183/1 "2008-05-13T09:38:06Z")

</div>

Hey Everyone,

I’m currently having problems finding anything thats helps me change the direction an image is facing depending on mouse moment. I’ve found stuff on rotation, but I want my image to flip so its facing the other way.

Any help would be apprieciated 😃

Natushi12

---

<div class="post-metadata">

### Author: ![sparkdemon](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@sparkdemon](https://forum.kirupa.com/u/sparkdemon)
#### Post date: [May 13, 2008, 10:02am UTC](https://forum.kirupa.com/t/changing-image-direction-in-easing/260183/2 "2008-05-13T10:02:27Z")

</div>

assuming that your image is inside a movieclip…  
movieclip.\_xscale \*= -1; // this will change the direction

as for mouse detection…

if(\_root.\_xmouse\>Stage.width/2)  
{  
movieclip.\_xscale \*= -1;  
}  
else if(\_root.\_xmouse\<Stage.width/2)  
{  
movieclip.\_xscale \*= -1;  
}  
else  
{  
// do nothing if mouse is in center  
}

[quote=Natushi12;2325461]Hey Everyone,

I’m currently having problems finding anything thats helps me change the direction an image is facing depending on mouse moment. I’ve found stuff on rotation, but I want my image to flip so its facing the other way.

Any help would be apprieciated 😃

Natushi12[/quote]

---

<div class="post-metadata">

### Author: ![Natushi12](https://avatars.discourse-cdn.com/v4/letter/n/ba8739/32.png) [@Natushi12](https://forum.kirupa.com/u/Natushi12)
#### Post date: [May 13, 2008, 10:57am UTC](https://forum.kirupa.com/t/changing-image-direction-in-easing/260183/3 "2008-05-13T10:57:25Z")

</div>

[quote=sparkdemon;2325468]assuming that your image is inside a movieclip…  
movieclip.\_xscale \*= -1; // this will change the direction

as for mouse detection…

if(\_root.\_xmouse\>Stage.width/2)  
{  
movieclip.\_xscale \*= -1;  
}  
else if(\_root.\_xmouse\<Stage.width/2)  
{  
movieclip.\_xscale \*= -1;  
}  
else  
{  
// do nothing if mouse is in center  
}[/quote]

What parts exactly am I applying this to?

---

<div class="post-metadata">

### Author: ![sparkdemon](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@sparkdemon](https://forum.kirupa.com/u/sparkdemon)
#### Post date: [May 13, 2008, 10:59am UTC](https://forum.kirupa.com/t/changing-image-direction-in-easing/260183/4 "2008-05-13T10:59:52Z")

</div>

“movieclip” will be the MovieClip actually holding your image.  
and the code should be placed where your movie clip is.

> [@Natushi12;2325485](#):
>
> What parts exactly am I applying this to?

---

<div class="post-metadata">

### Author: ![Natushi12](https://avatars.discourse-cdn.com/v4/letter/n/ba8739/32.png) [@Natushi12](https://forum.kirupa.com/u/Natushi12)
#### Post date: [May 13, 2008, 11:28am UTC](https://forum.kirupa.com/t/changing-image-direction-in-easing/260183/5 "2008-05-13T11:28:42Z")

</div>

[quote=sparkdemon;2325486]“movieclip” will be the MovieClip actually holding your image.  
and the code should be placed where your movie clip is.[/quote]

I have it sort of working, though my movie clip is twitching a lot (quickly changing from one direction to another) as I move the mouse around and sometimes doesnt face the wrong way. Any ideas on why thats happening?

NB: I did add a onMouseMove = function(){ at the beginning
