grazie mille. comunque io ho trovato questo e funziona

(Stage.width < sfondo._width) ? Stage.width - 20 : sfondo._x + sfondo._width - 20;