Be a Supporter!

A Movieclip With A Fish's Memory

  • 239 Views
  • 3 Replies
New Topic Respond to this Topic
wagnerben
wagnerben
  • Member since: May. 27, 2007
  • Offline.
Forum Stats
Member
Level 11
Blank Slate
A Movieclip With A Fish's Memory 2011-05-06 04:26:45 Reply

Hey there, fellow flashers!

I've come across a predicament of sorts that I can't seem to figure out.
I have a MovieClip (a shirt) inside another MovieClip (my character) and when the variable "shirtColor"==blue, it goes to that frame on the shirt MC; The problem is, when my character starts walking, his shirt changes back to the original color for a frame, then back to blue.
I'm sure i could make this un-noticeable if I were to increase the FPS, but I'd rather not do that. My problem seems to be that I need to know how to make my MC store the info so the next time it pops up on screen, it's already that color. Is there a way to do this?
Right now, my code is basically this:

onClipEvent(enterFrame){
if(shirtColor=="blue"){
character.shirt.gotoAndStop("blue"){
else{}
}

I'm guessing the problem is the "enterFrame" part.

I'm generally good at figuring these things out on my own, but this one has me stumped.
I call out to you, NewGrounds and your mystical wisdom. HALP!


i like to have fun with the girls.

BBS Signature
Gimmick
Gimmick
  • Member since: Aug. 20, 2008
  • Offline.
Forum Stats
Member
Level 27
Programmer
Response to A Movieclip With A Fish's Memory 2011-05-06 05:10:21 Reply

A fish's memory is not short.

That being said, you can put the shirt MC on a separate layer, that way the same object is being used throughout the animation or whatever your character is doing. If you put frames in it, flash treats those things as separate MCs and so they reset to frame one. Duplicate the object in a new layer, or select the shirt MC and press Ctrl+Shift+D or something.


Slint approves of me! | "This is Newgrounds.com, not Disney.com" - WadeFulp
"Sit look rub panda" - Alan Davies

BBS Signature
FlashKid
FlashKid
  • Member since: Nov. 22, 2003
  • Offline.
Forum Stats
Member
Level 14
Blank Slate
Response to A Movieclip With A Fish's Memory 2011-05-06 08:55:14 Reply

or you could just put

if(shirtColor=="blue"){
shirt.gotoAndStop("blue"){
else{}

at the start of each animation xD. Additional lols for epic work arounds.


Your path is dark.

Sam
Sam
  • Member since: Oct. 1, 2005
  • Offline.
Forum Stats
Moderator
Level 19
Programmer
Response to A Movieclip With A Fish's Memory 2011-05-06 11:20:37 Reply

If your frame labels are the same as the string variable you can just do this:

character.shirt.gotoAndStop(shirtColour)