i have the problem in zooming...
inside the flash,there have consists 6 button of up,down,left right, zoom in and zoom out
when i click the key in the device central simulates!(e.g. click left and zoom in)
it will be zooming in deep in deeper of the image and start hanging!
any idea to solve this?
This is the code in below:
stop();
print_btn.onRelease = function() {
print("map", "bmax");
};
var pressedBtn = null;
moveUp.pressed = false;
moveUp.onPress = doPress;
moveLeft.pressed = false;
moveLeft.onPress = doPress;
moveRight.pressed = false;
moveRight.onPress = doPress;
moveDown.pressed = false;
moveDown.onPress = doPress;
//
zoomIn.pressed = false;
zoomIn.onPress = doPress;
zoomOut.pressed = false;
zoomOut.onPress = doPress;
//
function doPress() {
pressedBtn = this;
this.pressed = true;
onMouseUp = function () {
pressedBtn = null;
this.pressed = false;
delete this.onMouseUp;
};
}
function doClamp(low, value, high) {
return Math.min(Math.max(value, low), high);
}
function initMap() {
map.areaW = mask_mc._width;
map.areaH = mask_mc._height;
map._x = map.areaX=mask_mc._x;
map._y = map.areaY=mask_mc._y;
map.maxX = map.areaX+map.areaW;
map.maxY = map.areaY+map.areaH;
map.inc = 10;
map.maxZoom = 200;
map._xscale = map._yscale=map.minZoom=100/Math.min(map._width/mask_mc._width, map._height/mask_mc._height);
map.tmp1 = 0;
map.tmp2 = 0;
//
map.onEnterFrame = function() {
switch (pressedBtn) {
case null :
break;
case zoomIn :
if (this._xscale<this.maxZoom) {
this.tmp1 = this._width;
this.tmp2 = this._height;
this._yscale = this._xscale++;
this._x -= (this._width-this.tmp1)/2;
this._y -= (this._height-this.tmp2)/2;
}
break;
case zoomOut :
if (this._xscale>this.minZoom) {
this.tmp1 = this._width;
this.tmp2 = this._height;
this._yscale = this._xscale--;
this.tmp1 = this._x+(this.tmp1-this._width)/2;
this.tmp2 = this._y+(this.tmp2-this._height)/2;
this._x = doClamp(this.maxX-this._width, this.tmp1, this.areaX);
this._y = doClamp(this.maxY-this._height, this.tmp2, this.areaY);
}
break;
case moveLeft :
if (this._x+this.inc<this.areaX) {
this._x += this.inc;
}
break;
case moveRight :
if (this._x+this._width-this.inc>this.maxX) {
this._x -= this.inc;
}
break;
case moveUp :
if (this._y+this.inc<this.areaY) {
this._y += this.inc;
}
break;
case moveDown :
if (this._y+this._height-this.inc>this.maxY) {
this._y -= this.inc;
}
break;
default :
break;
}
};
}
initMap();
Thanks in advance for your assistance.
Regards,
Vaan_Dino



