Action button on specific layer (disappears when layer gone)

Is it possible to set an action button into a specific layer, such that the action button ceases to be clickable when the layer is overridden?