flash - ActionScript 3 - MovieClip Scale, set to 1 when scale is less than 1 -
i have movieclip of image , have applied transformgestureevent , working well, having issues when trying scale less 1. dont want scale less 1 put condition in transformgestureevent when tries scale less 1 scale gets reset 1...i hope makes sense.
here snippet of code giving me trouble.
if(event.scaley < 1.1 && floorplanmc.scaley < 1){ floorplanmc.scalex=prevscalex; floorplanmc.scaley=prevscaley; }
and here full method:
function zoomfloorplan (event:transformgestureevent):void{ mytimermodel.stop(); mytimermodel.reset(); mytimermodel.start(); var locx:number=event.localx; var locy:number=event.localy; var stx:number=event.stagex; var sty:number=event.stagey; var prevscalex:number=floorplanmc.scalex; var prevscaley:number=floorplanmc.scaley; var mat:matrix; var externalpoint=new point(stx,sty); var internalpoint=new point(locx,locy); floorplanmc.scalex *= event.scalex; floorplanmc.scaley *= event.scaley; if(event.scalex > 1 && floorplanmc.scalex > 6){ floorplanmc.scalex=prevscalex; floorplanmc.scaley=prevscaley; } if(event.scaley > 1 && floorplanmc.scaley > 6){ floorplanmc.scalex=prevscalex; floorplanmc.scaley=prevscaley; } if(event.scalex < 1.1 && floorplanmc.scalex < 1){ floorplanmc.scalex=prevscalex; floorplanmc.scaley=prevscaley; } if(event.scaley < 1.1 && floorplanmc.scaley < 1){ floorplanmc.scalex=prevscalex; floorplanmc.scaley=prevscaley; } mat=floorplanmc.transform.matrix.clone(); matrixtransformer.matchinternalpointwithexternal(mat,internalpoint,externalpoint); floorplanmc.transform.matrix=mat; }
i dont errors, expecting if try scale less 1, scale of floorplanmc 1 , movieclip goes scale was. doesn't go originally, scale goes less 1.
Comments
Post a Comment