# Button swaps part of image

**URL:** <https://forum.kirupa.com/t/button-swaps-part-of-image/14441>\
**Category:** Uncategorized\
**Created:** [February 26, 2003, 6:20am UTC](https://forum.kirupa.com/t/button-swaps-part-of-image/14441 "2003-02-26T06:20:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![janwatson](https://avatars.discourse-cdn.com/v4/letter/j/f07891/32.png) [@janwatson](https://forum.kirupa.com/u/janwatson)\
**Post date:** [February 26, 2003, 6:20am UTC](https://forum.kirupa.com/t/button-swaps-part-of-image/14441/1 "2003-02-26T06:20:22Z")

</div>

Hi,

Newbie question. It’s for an art project.

I have a head graphic and seven hairstyles.

I’d like the user to be able to push one button and cycle through the hairstyles as they swap on the head graphic, choosing the one they prefer.

I’d be grateful if you could help me with the simplest solution in Flash MX.

Thank you.

Jan Watson

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 26, 2003, 6:52am UTC](https://forum.kirupa.com/t/button-swaps-part-of-image/14441/2 "2003-02-26T06:52:02Z")

</div>

Hi…

That part is somewhat easy… But it ALL depends on what you are trying to do with that… Let’s just assume that you have one movieclip that contains seven hairstyles from frame 1 to frame 7 in that timeline…

In the button of the main timeline, you will have a button with this script…

```php
Btn_Select.onPress = function ()
{
	i++;
	goFrame = i % 7;
	if (goFrame == 0)
		goFrame = 7;
	_level0.hair.gotoAndStop(goFrame);
}

```

See if this helps you… =)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 27, 2003, 4:15am UTC](https://forum.kirupa.com/t/button-swaps-part-of-image/14441/3 "2003-02-27T04:15:00Z")

</div>

Thank you Cyan Blue,

I got myself into a different corner in the mean time.

i have the seven hairstyles in seven consecutive frames of a movie clip.

A botton with the attached action “go to next frame and stop”.

This works fine development but when published the frames run through.

Jan Watson

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 27, 2003, 4:43am UTC](https://forum.kirupa.com/t/button-swaps-part-of-image/14441/4 "2003-02-27T04:43:56Z")

</div>

Well… One thing you can try is to put the stop() function on all frames… Try that and if that doesn’t work, why don’t you create a little sample so that I can check it??? C:-)
