If/Else but button don't appear back

Hi everyone,

I would very much appreciate if someone can help me with this or give me any tips: button is not coming back when it’s supposed to.

I am building a simple image galery. I have all my images side to side on a pictures_mc, a forward and backward button.

The buttons work with an as3 that moves the mc accordingly

forward_btn.addEventListener(MouseEvent.CLICK, function(){
limits()
new Tween (pictures_mc,“x”,Strong.easeOut,pictures_mc.x, pictures_mc.x - 500, 1.5, true) })

I want the backward button to desapear when it’s the first picture and the forward when it’s the last. So I tried if and else:

function limits(){
if(pictures_mc.x >= 400){
forward_btn.visible=false
}else{
forward_btn.visible=true
}
}

The if is working and the button desapear, but the button does not appear back at least for a few pictures/clicks.

How can I fix this???

Thanks you so much