# Listener question if on frame x then do this

**URL:** https://forum.kirupa.com/t/listener-question-if-on-frame-x-then-do-this/207411
**Category:** Uncategorized
**Created:** [November 17, 2006, 4:38am UTC](https://forum.kirupa.com/t/listener-question-if-on-frame-x-then-do-this/207411 "2006-11-17T04:38:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mileskemp](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@mileskemp](https://forum.kirupa.com/u/mileskemp)
#### Post date: [November 17, 2006, 4:38am UTC](https://forum.kirupa.com/t/listener-question-if-on-frame-x-then-do-this/207411/1 "2006-11-17T04:38:54Z")

</div>

hey i am trying to write a function that works with the xml slideshow on kirupa. i want buttion to be visible or not visible based on the listening to what frame/image the slider is on.

I will not change when the image changes but the code is:

addListener§;  
if (p = 0){  
red1.\_visible = 1;  
red2.\_visible = 0;  
red3.\_visible = 0;  
red4.\_visible = 0;  
};  
if (p = 1){  
red1.\_visible = 0;  
red2.\_visible = 1;  
red3.\_visible = 0;  
red4.\_visible = 0;  
};  
if (p = 2){  
red1.\_visible = 0;  
red2.\_visible = 0;  
red3.\_visible = 1;  
red4.\_visible = 0;  
};  
if (p = 3){  
red1.\_visible = 0;  
red2.\_visible = 0;  
red3.\_visible = 0;  
red4.\_visible = 1;  
};

p is the frame number same variable as in the tutorial.

thanks again

miles
