Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Some Action Script 2 Help...  (Read 1275 times)

0 Members and 1 Guest are viewing this topic.
Some Action Script 2 Help...
« on: November 12, 2008, 09:52:31 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 222
Not sure if this is the right forum.  If not, please move.

Alright.  I've been working on this project for a while for my flash class.  I've already turned it in but I'm fixing it the way I wanted.

Anyway, my problem is I want a Movie Clip (instance name = menu_txt) to rotate and come to a smooth stop when I click a button (instance name = up_arrow).  It works but only once.



So, basically, I have that image.  I want it to rotate counter-clockwise.  It starts out where it says "Str."  The rotation when I click the up arrow works from 1 to 2 but doesn't from 2-3 3-4.

The code I have set is on the frame on an other layer.

Code: [Select]
up_arrow.onRelease = function() {
if (menu_txt.rotation = 0){
trace(menu_txt.rotation);
menu_txt.rotateTo (-90, 2, "easeOut", 0);
swishSound.start(0, 1);
}else if (menu_txt.rotation = -90){
trace(menu_txt.rotation);
menu_txt.rotateTo (-180, 2, "easeOut", 0);
swishSound.start(0, 1);
}else if (menu_txt.rotation = -190){
trace(menu_txt.rotation);
menu_txt.rotateTo (-270, 2, "easeOut", 0);
swishSound.start(0, 1);
}else if (menu_txt.rotation = -270){
knockSound.start(0, 1);
}
}

Like I said, the first one works but the other 3 don't.  Any ideas.  I can provide more info if need be.
« Last Edit: November 12, 2008, 09:58:43 am by OozyGorilla »
Logged

under the alias DarkLink6235
Re: Some Action Script 2 Help...
« Reply #1 on: November 12, 2008, 01:51:28 pm »
  • Fear my Blades
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 562
It could automatically be converting that -90 rotation to 270.

I'd probably use a variable to keep track of how many times it's been rotated for when you want it to stop, then just rotate it by it's current rotation - 90.  You should be able to do something like "if (menu_txt.rotation%90==0)" to make sure it isn't between slots before you start rotating it.
Logged

I've done it (sorta)!  Bloom Lighting in GameMaker, and 3D mode too!  Check out the awesome Screen Saver.
  • Kousou Games
Re: Some Action Script 2 Help...
« Reply #2 on: November 12, 2008, 03:24:51 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 222
I figured it out.

I need to change all the "if (menu_txt.rotation = 0)" to "if (menu_txt.rotation == 0)"

Funny how code works that way.
Logged

under the alias DarkLink6235
Re: Some Action Script 2 Help...
« Reply #3 on: November 12, 2008, 05:33:05 pm »
  • Fear my Blades
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 562
Ah, yeah, I make that mistake sometimes too.  I usually get a warning from the compiler for it though.
Logged

I've done it (sorta)!  Bloom Lighting in GameMaker, and 3D mode too!  Check out the awesome Screen Saver.
  • Kousou Games
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.036 seconds with 42 queries.