# Button visibility and \_x slide

**URL:** <https://forum.kirupa.com/t/button-visibility-and--x-slide/297340>\
**Category:** Uncategorized\
**Created:** [September 30, 2009, 2:17pm UTC](https://forum.kirupa.com/t/button-visibility-and--x-slide/297340 "2009-09-30T14:17:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dansimon30](https://avatars.discourse-cdn.com/v4/letter/d/0ea827/32.png) [@dansimon30](https://forum.kirupa.com/u/dansimon30)\
**Post date:** [September 30, 2009, 2:17pm UTC](https://forum.kirupa.com/t/button-visibility-and--x-slide/297340/1 "2009-09-30T14:17:42Z")

</div>

I am very close to creating an \_x slide that would reveal several different images/buttons inside a mask. I need the buttons to be visible or invisible ( depending on img\_mc \_x position ) both at the beginning and end of the graphic that is being slid across the mask. ( img\_mc) The “back” button should be invisible only if img\_mc is at the left most position ( minX )…and the “next” button to be invisible at the right most position ( maxX ). so far I can make “next” work well but “back” is giving me issues…Primarily I cant hide it initially…and when it does get hidden…it dosnt reveal after img\_mc leaves the determined hide position.

please advise!!!

heres the code…

var minX =250;  
var maxX = -3536;  
var stepX = -757.25;

back\_btn.onRollOver=function(){  
back\_btn.gotoAndPlay(“blink”);  
}  
back\_btn.onRollOut=function(){  
back\_btn.gotoAndStop(“start”);  
}  
back\_btn.onRelease = function() {  
img\_mc.\_x -= stepX;  
if(img\_mc.\_x\>=maxX){  
back\_btn.\_visible = true;  
next\_btn.\_visible = true;  
}  
};

next\_btn.onRollOver=function(){  
next\_btn.gotoAndPlay(“blink”);  
}  
next\_btn.onRollOut=function(){  
next\_btn.gotoAndStop(“start”);  
}  
next\_btn.onRelease = function() {  
img\_mc.\_x += stepX;  
if(img\_mc.\_x\<=maxX){  
back\_btn.\_visible = true;  
next\_btn.\_visible = false;  
}  
};
