# Variable problems

**URL:** https://forum.kirupa.com/t/variable-problems/7662
**Category:** Uncategorized
**Created:** [November 5, 2002, 2:03pm UTC](https://forum.kirupa.com/t/variable-problems/7662 "2002-11-05T14:03:09Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![hsadan](https://avatars.discourse-cdn.com/v4/letter/h/7bcc69/32.png) [@hsadan](https://forum.kirupa.com/u/hsadan)
#### Post date: [November 5, 2002, 2:03pm UTC](https://forum.kirupa.com/t/variable-problems/7662/1 "2002-11-05T14:03:09Z")

</div>

I’m making a navigation bar.  
when u click on a button, i would like an indicator to appear above the button.  
i create a separate movie clip, which is the indicator, that starts offscreen and moves to its position when the user rolls over the button, and then stays there if the user clicks the button, but disappears when the user rolls out without clicking.

here’s my script i got so far:

```auto

on (rollOver) {
	tellTarget (indicator) {
		gotoAndPlay(1);
	}
	set (x,1);
}
on (release) {
	tellTarget (indicator) {
		gotoAndStop(10);
	}
}
on (rollOut) {
	if (x=1) {
	tellTarget (indicator) {
		gotoAndStop(10);
	}
	} else {
	tellTarget (indicator) {
		gotoAndStop(1);
	}
}
}

```

frame1 would be the indicator offscreen, and when played would bring the indicator to it’s position at frame10. the problem i have right now is that when i rollout without or without clicking, the idicator stays at frame10; and the rollover event seems to work only the first time.  
i’m kinda new at variables…have i done it right?  
thx 🙂

---

<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: [November 6, 2002, 11:01am UTC](https://forum.kirupa.com/t/variable-problems/7662/2 "2002-11-06T11:01:51Z")

</div>

Hi,

```auto

on (rollOver) {
indicator.gotoAndPlay(2);
x=0;	
}
on(press){
x=1;
}
on (release) {	
	//no action for indicator	
}
on (rollOut) {
	if (x!=1) {
	indicator.gotoAndStop(1);	
	} 

}

```

Cheers

SHO

Ps.: in 'if statements equal has to be double( **==** ).

---

<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: [November 6, 2002, 2:11pm UTC](https://forum.kirupa.com/t/variable-problems/7662/3 "2002-11-06T14:11:07Z")

</div>

whoo~ ok…thx…

---

<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: [November 6, 2002, 2:36pm UTC](https://forum.kirupa.com/t/variable-problems/7662/4 "2002-11-06T14:36:35Z")

</div>

U r welcome

SHO
