Flip Horizontal a Movie

  • masster
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Feb 24, 2004
  • Posts: 6
  • Status: Offline

Post March 13th, 2004, 8:37 pm

Hi,

Is it possible to flip horizontal an instance of a movie by Action Script?

That would solve me a lot of issues.

Thanks.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post March 13th, 2004, 8:37 pm

  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Joined: Jun 26, 2003
  • Posts: 1402
  • Loc: Philadelphia, PA
  • Status: Offline

Post March 13th, 2004, 8:57 pm

Code: [ Select ]
clipInstanceName._xscale *= -1


clipInstanceName being the instance name assigned to your movieclip symbol.

_xscale being the property of a clip that resizes it's width according to a percentage (default is obviously 100%)

*= -1 takes the current _xscale value (again, default is 100) and multiplies it by 1 (thus created -100), which then flips the clip horizontally.
  • masster
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Feb 24, 2004
  • Posts: 6
  • Status: Offline

Post March 14th, 2004, 3:17 pm

Cool!

:oops: So simple, yet so powerful... :)
  • UNFLUX
  • Genius
  • Genius
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 6382
  • Loc: twitter.com/unflux
  • Status: Offline

Post March 14th, 2004, 3:28 pm

that's the beauty of actionScript :)
UNFLUX.FOTO
  • partyjan
  • Student
  • Student
  • No Avatar
  • Joined: Feb 15, 2007
  • Posts: 69
  • Loc: Norway
  • Status: Offline

Post February 15th, 2007, 5:52 am

I have an animation of a fish that will swim back and forward. And when I type left I want hime to flip horizontal. And with this code it did, but the problem is that it does flip horizontal everytime I press the left key.

I want "the fish" to flip ones, and flip again when I flip right and then he may flip again when I THEN PRESS LEFT...

hope you somebody understands my problem. Thanks!


KeyListener1.onKeyDown = function () {
if (Key.isDown(Key.LEFT)){
Xhastighet--;
break;
fisk._xscale *= -1;
}
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Joined: Nov 05, 2004
  • Posts: 1254
  • Loc: Ro
  • Status: Offline

Post February 15th, 2007, 10:36 pm

Code: [ Select ]
KeyListener1.onKeyDown = function ()
{
  if (Key.isDown(Key.LEFT))
 {
   Xhastighet--;
   break;
   if (fisk._xscale < 0)
       fisk._xscale *= -1;
}
  1. KeyListener1.onKeyDown = function ()
  2. {
  3.   if (Key.isDown(Key.LEFT))
  4.  {
  5.    Xhastighet--;
  6.    break;
  7.    if (fisk._xscale < 0)
  8.        fisk._xscale *= -1;
  9. }

if default the fish is with his head toward left, then leave this code as it is.
if is hea toward right then the condition will be:
Code: [ Select ]
if (fisk._xscale > 0)
fisk._xscale *= -1;
  1. if (fisk._xscale > 0)
  2. fisk._xscale *= -1;
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
  • partyjan
  • Student
  • Student
  • No Avatar
  • Joined: Feb 15, 2007
  • Posts: 69
  • Loc: Norway
  • Status: Offline

Post February 16th, 2007, 4:52 am

I used that code on

(Key.isDown(Key.RIGHT))

too, and it work prfectly as I wanted:)

thanks!
  • pns
  • Born
  • Born
  • No Avatar
  • Joined: May 26, 2007
  • Posts: 1
  • Status: Offline

Post May 27th, 2007, 12:06 am

็Hi,
I'm a newbie and know very little about AS, so I get confused what 'KeyLintener1' and 'Xhastighet--' refer to. Could you be so kind as to give additional explanation, please?
Looking forward to you kind help.
High regards,
PNS
  • noordhoeka
  • Born
  • Born
  • No Avatar
  • Joined: Nov 08, 2010
  • Posts: 1
  • Status: Offline

Post November 8th, 2010, 8:28 am

Hi
I have the same type of issue, except I have my movie clip following a mouse rather than using keys.

The fish is facing right, how would I get the fish to face left when the mouse is to the left of the fish?

onClipEvent (enterFrame) {
_root.yChange = Math.round(_root._ymouse-this._y);
_root.xChange = Math.round(_root._xmouse-this._x);
_root.yMove = Math.round(_root.yChange/5);
_root.xMove = Math.round(_root.xChange/5);
this._y += _root.yMove;
this._x += _root.xMove;
}

thanks
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Joined: Nov 05, 2004
  • Posts: 1254
  • Loc: Ro
  • Status: Offline

Post November 17th, 2010, 4:53 am

mmm, you guys should learn how to use what you know, extend it and use your logic to apply it for your current situation.
In your case is basically the same.
Code: [ Select ]
// if mouse in left side (xMouse < this.x)
if (_root.xMove < 0)
{
 if (this._xscale < 0) // if not already flipped
  this._xscale *= -1;
}
else // if mouse in right side (xMouse > this.x)
{
 if (this._xscale > 0) // if not already flipped
  this._xscale *= -1;
}
  1. // if mouse in left side (xMouse < this.x)
  2. if (_root.xMove < 0)
  3. {
  4.  if (this._xscale < 0) // if not already flipped
  5.   this._xscale *= -1;
  6. }
  7. else // if mouse in right side (xMouse > this.x)
  8. {
  9.  if (this._xscale > 0) // if not already flipped
  10.   this._xscale *= -1;
  11. }
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”

Post Information

  • Total Posts in this topic: 10 posts
  • Users browsing this forum: No registered users and 32 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.