flex图片放大缩小

<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init();"> <mx:Script> <!--[CDATA[ import mx.effects.Zoom; import mx.controls.Alert; private var zoom:Zoom; private function init():void{ zoom = new Zoom; } private function Big():void{ if(hslider.value < 10){ hslider.value += 1; } zoomModify(); } private function Small():void{ if(hslider.value > 0){ hslider.value -= 1; } zoomModify(); } private function zoomModify():void { zoom.stop(); zoom.originX = img.width / 2; zoom.originY = img.height / 2; zoom.zoomWidthFrom = hslider.value; zoom.zoomHeightFrom = hslider.value; zoom.zoomWidthTo = hslider.value; zoom.zoomHeightTo = hslider.value; zoom.duration = 1000; zoom.target = img; zoom.play(); } ]]--> </mx:Script> <mx:HSlider id="hslider" x="260" y="30" minimum="1" maximum="10" value="1" liveDragging="true" change="zoomModify()" snapInterval="0.01" visible="true"/> <mx:Button id="zoomBig" label="+" click="Big()"/> <mx:Button id="zoomSmall" label="-" click="Small()" x="48"/> <mx:Canvas x="200" y="121" width="420" height="315" borderStyle="1"> <mx:Image id="img" source="assets/monitor/a1.png" horizontalCenter="0" verticalCenter="0"/> </mx:Canvas> </mx:Application>

 

你可能感兴趣的:(function,Flex,application,import,button,encoding)