# Problem with array and mc's frame

**URL:** <https://forum.kirupa.com/t/problem-with-array-and-mcs-frame/211670>\
**Category:** Uncategorized\
**Created:** [January 4, 2007, 2:09am UTC](https://forum.kirupa.com/t/problem-with-array-and-mcs-frame/211670 "2007-01-04T02:09:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![idjit](https://avatars.discourse-cdn.com/v4/letter/i/e99b99/32.png) [@idjit](https://forum.kirupa.com/u/idjit)\
**Post date:** [January 4, 2007, 2:09am UTC](https://forum.kirupa.com/t/problem-with-array-and-mcs-frame/211670/1 "2007-01-04T02:09:13Z")

</div>

okay. say you’re making a game where you design your character, and there’s a button to change his hairstyle. the code for the btn is on the first frame of the movie. i have messed around with this code for hours and can’t seem to find what’s wrong with it!Ⓜ for some reason, when i test the movie and click the btn, the hair mc doesn’t change to the next frame.:skull: here is my code:

var hairStyle:Array = new Array (1,2,3,4,5);  
var i:Number = 0;  
\_root.nextHair\_btn.onRelease = function () {  
if (i \< hairStyle.length - 1) {  
i++;  
}  
else {  
i = 0;  
}  
}  
onEnterFrame=function(){  
hairStyle = _;  
this.player.head.hair.gotoAndStop((hairStyle_));  
}

if anyone can fix this please let me know. any help would be appreciated.
