
Код AS1/AS2:
var r = 10;
var r1 = 2;
_root.d_text.selectable = false;
_root.img.onPress = function() {
startDrag(_root.img, false);
};
_root.img.onRelease = function() {
stopDrag();
};
_root.img._xscale = 50;
_root.img._yscale = 50;
_root.zoom_in.onRelease =
_root.zoom_in.onReleaseOutside = function() {
_root.resizeImage(_root.img, r);
};
_root.zoom_out.onRelease =
_root.zoom_out.onReleaseOutside = function() {
_root.resizeImage(_root.img, -r);
};
_root.onMouseMove = function() {
_root.d_text.text = "";
};
this.onMouseWheel = function(delta) {
_root.resizeImage(_root.img, r1 * ((delta > 0) ? 1 : -1) );
};
Mouse.addListener(this);
function resizeImage(target:MovieClip, scaleDelta:Number):Void {
var scale:Number = Math.min(Math.max(target._xscale + scaleDelta, 10), 100);
target._xscale = target._yscale = scale;
if (scale == 10) {
_root.d_text.text = "Размер фотографии минимальный !";
} else if (scale == 100) {
_root.d_text.text = "Размер фотографии максимальный !";
} else {
_root.d_text.text = "";
}
}
UPD: Поле var для динамического текста оставьте пустым. Это устаревший способ обращения к текстовому полю.