# Need Help with turning a movie clip on/off

**URL:** <https://forum.kirupa.com/t/need-help-with-turning-a-movie-clip-on-off/25544>\
**Category:** flash\
**Created:** [July 14, 2003, 7:12am UTC](https://forum.kirupa.com/t/need-help-with-turning-a-movie-clip-on-off/25544 "2003-07-14T07:12:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![drclare](https://avatars.discourse-cdn.com/v4/letter/d/ac91a4/32.png) [@drclare](https://forum.kirupa.com/u/drclare)\
**Post date:** [July 14, 2003, 7:12am UTC](https://forum.kirupa.com/t/need-help-with-turning-a-movie-clip-on-off/25544/1 "2003-07-14T07:12:49Z")

</div>

I have written this script for a button to turn a movie clip on or off. I want it to set the movie clip’s opacity to 0 if it is already at 100 or to 100 if it is already at 0. But it will only set it to 0 if it is 100. Can anyone tell me why my script doesn’t work? Thank you.

on(release) {  
if (this.Highlights.\_alpha = 100) {  
setProperty(“Highlights”, \_alpha, “0”);  
setProperty(“HighlightsButton”,\_alpha, “50”);  
} else {  
setProperty(“Highlights”, \_alpha, “100”);  
setProperty(“HighlightsButton”, \_alpha, “100”);  
}  
}

---

<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:** [July 14, 2003, 7:26am UTC](https://forum.kirupa.com/t/need-help-with-turning-a-movie-clip-on-off/25544/2 "2003-07-14T07:26:33Z")

</div>

You need to use == to check if something is equal to something else. Also setProperty is replaced by the much easier dot syntax…

[AS]on(release) {  
if (Highlights.\_alpha == 100) {  
Highlights.\_alpha = 0;  
HighlightsButton.\_alpha = 50;  
} else {  
Highlights.\_alpha = 100;  
HighlightsButton.\_alpha = 100;  
}  
}[/AS]

---

<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:** [July 14, 2003, 7:31am UTC](https://forum.kirupa.com/t/need-help-with-turning-a-movie-clip-on-off/25544/3 "2003-07-14T07:31:30Z")

</div>

continued…

If you really want to make your clip invisible (\_alpha = 0 can be seen on 16bit color), you can use the \_visble property…

[AS]on(release) {  
//if Highlights \_visible property is true  
if (Highlights.\_visible) {  
//make set it to false to hide the clip  
Highlights.\_visible = false;  
HighlightsButton.\_alpha = 50;  
} else {  
//else set it to true to make it reappear  
Highlights.\_visible = true;  
HighlightsButton.\_alpha = 100;  
}  
}[/AS]

---

<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:** [July 14, 2003, 7:39am UTC](https://forum.kirupa.com/t/need-help-with-turning-a-movie-clip-on-off/25544/4 "2003-07-14T07:39:43Z")

</div>

Great, that’s even better. I didn’t know alpha could be seen on 16bit display so alpha was the only way i could think of to turn the clip off. Thank you for the help. It work right now.

I did try the == before but it still didn’t work. Was that because i was using setProperty along with the .syntax on the line above?

---

<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:** [July 14, 2003, 7:44am UTC](https://forum.kirupa.com/t/need-help-with-turning-a-movie-clip-on-off/25544/5 "2003-07-14T07:44:17Z")

</div>

> \*Originally posted by lostinbeta \*  
> **\_alpha = 0 can be seen on 16bit color**  
> Didnt know dat, thx lostinbeta. :thumb:

---

<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:** [July 14, 2003, 7:50am UTC](https://forum.kirupa.com/t/need-help-with-turning-a-movie-clip-on-off/25544/6 "2003-07-14T07:50:45Z")

</div>

It’s good to know that we’re all still learning.

---

<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:** [July 14, 2003, 3:56pm UTC](https://forum.kirupa.com/t/need-help-with-turning-a-movie-clip-on-off/25544/7 "2003-07-14T15:56:44Z")

</div>

drclare: I believe it wasn’t working when you used == because you also used “this” (this.Highlights).

claudio: no problem :thumb:

---

<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:** [July 14, 2003, 7:43pm UTC](https://forum.kirupa.com/t/need-help-with-turning-a-movie-clip-on-off/25544/8 "2003-07-14T19:43:57Z")

</div>

Oh, ok. Thanks again.
