Code:
function dragZoom(movieClip) {
_global.homeX = 314;
_global.homeY = 219;
_global.zoomIncrement = 10;
_global.zoomAmount = 200;
function zoomIn(movieClip) {
if(movieClip._yscale && movieClip._xscale < zoomAmount) {
movieClip._xscale = movieClip._xscale + zoomIncrement;
movieClip._yscale = movieClip._yscale + zoomIncrement;
}
}
function zoomOut(movieClip) {
if(movieClip._yscale && movieClip._xscale > 100) {
movieClip._xscale = movieClip._xscale - zoomIncrement;
movieClip._yscale = movieClip._yscale - zoomIncrement;
}
}
movieClip.onMouseDown = function() {
this.startDrag();
movieClip.onEnterFrame = function() {
zoomIn(this);
}
}
movieClip.onRelease = function() {
this.stopDrag();
movieClip.onEnterFrame = function() {
zoomOut(this);
image._x = image._x - (image._x - homeX) / 5;
image._y = image._y - (image._y - homeY) / 5;
}
}
}
dragZoom(image);
function dragZoom(movieClip) {
_global.homeX = 314;
_global.homeY = 219;
_global.zoomIncrement = 10;
_global.zoomAmount = 200;
function zoomIn(movieClip) {
if(movieClip._yscale && movieClip._xscale < zoomAmount) {
movieClip._xscale = movieClip._xscale + zoomIncrement;
movieClip._yscale = movieClip._yscale + zoomIncrement;
}
}
function zoomOut(movieClip) {
if(movieClip._yscale && movieClip._xscale > 100) {
movieClip._xscale = movieClip._xscale - zoomIncrement;
movieClip._yscale = movieClip._yscale - zoomIncrement;
}
}
movieClip.onMouseDown = function() {
this.startDrag();
movieClip.onEnterFrame = function() {
zoomIn(this);
}
}
movieClip.onRelease = function() {
this.stopDrag();
movieClip.onEnterFrame = function() {
zoomOut(this);
image._x = image._x - (image._x - homeX) / 5;
image._y = image._y - (image._y - homeY) / 5;
}
}
}
dragZoom(image);
Ako pokusam da stavim jos jedan isti takav klip sa istim tim kodom, totalno poblesave jer flash ne zna sta sam kliknuo i onda se jedan uvec kada i drugi, prvi kada se smanji drugi.
Razmisljao sam da sve to ubacim da se izvrsava preko onClipEvent (ceo kod u movie clip) ali ne znam kako to da odradim.
Citam nesto da moze preko hitTest da se uradi:
Code:
/* Prevlacenje slike i vracanje na njeno staro mesto */
onClipEvent(load){
origX=this._x;
origY=this._y;
}
onClipEvent(mouseDown){
if(this.hitTest(_root._xmouse,_root._ymouse)){
this.startDrag();
}
}
onClipEvent(mouseUp){
if(this.hitTest(_root._xmouse,_root._ymouse)){
this.stopDrag();
this._x=origX;
this._y=origY;
}
}
/* Prevlacenje slike i vracanje na njeno staro mesto */
onClipEvent(load){
origX=this._x;
origY=this._y;
}
onClipEvent(mouseDown){
if(this.hitTest(_root._xmouse,_root._ymouse)){
this.startDrag();
}
}
onClipEvent(mouseUp){
if(this.hitTest(_root._xmouse,_root._ymouse)){
this.stopDrag();
this._x=origX;
this._y=origY;
}
}
ali ne znam kako to da uradim
Moze li neka pomoc?
Primer sam nasao na
http://www.actionscript.org/forums/showthread.php3?t=72499
P.S.
Ovo mi treba za zumiranje vise slika (nesto kao photo-album) koji cu da ubacim u animaciju.
[Ovu poruku je menjao ferguson dana 18.03.2008. u 13:15 GMT+1]