# Making a button invisible

**URL:** <https://forum.kirupa.com/t/making-a-button-invisible/274562>\
**Category:** Uncategorized\
**Created:** [October 31, 2008, 3:40pm UTC](https://forum.kirupa.com/t/making-a-button-invisible/274562 "2008-10-31T15:40:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AgentOrange](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@AgentOrange](https://forum.kirupa.com/u/AgentOrange)\
**Post date:** [October 31, 2008, 3:40pm UTC](https://forum.kirupa.com/t/making-a-button-invisible/274562/1 "2008-10-31T15:40:57Z")

</div>

Hi all. I have an actionscript question that I’m hoping someone can help me out with. I’ve built (with help from these forums) an image scroller but I’d like to make the ‘next’ and ‘previous’ buttons invisible at the first and last frames frames respectively. The code I’m using for the scroll is below. I think the code I’m after should be something like this:

```auto
if (targetX<720) {
    btn_Previous.visible = false;
} 

```

But I can’t work out where I should put it (or even if it’s correct) within the scroller code.

```auto
stop();
var targetX:Number = 0;
var speed:Number = 6;

m_Images.onEnterFrame = function() {
    this._x += (targetX-this._x)/speed;
};

btn_Next.onRelease = function() {
    if (targetX>-8640) {
        targetX -= 720;
    }
};

btn_Previous.onRelease = function() {
    if (targetX<0) {
        targetX += 720;
    }
};

```
