horizontalCenter and X position
hello
i have given the horizontalcenter and verticalcenter 0,0 to a image for
proper working of zooming image.
but i am facing difficulties in rotation and antirotation it is not taking
originX and originY
here is the cide
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
pageTitle="Smooth Images" layout="absolute"
width="100%" height="600" creationComplete="ini();" >
<mx:Script>
<![CDATA[
import mx.containers.Canvas;
private var cv:Canvas=new Canvas();
[Bindable]
private var angle:int=0;
private function ini():void{
rotate1.target=img;
rotate2.target=img;
rButton.addEventListener(MouseEvent.CLICK,rot);
arButton.addEventListener(MouseEvent.CLICK,antirot );
mycanvas.addChild(cv);
img.setStyle("horizontalCenter",0);
img.setStyle("verticalCenter",0);
cv.setStyle("borderStyle","solid");
cv.width=900;cv.height=900;cv.horizontalScrollPoli cy="off";cv.verticalScrollP
olicy="off";
cv.addChild(img);
}
private function rot(event:Event):void{
rotate1.end();angle += 90;rotate1.play();
ll.data=rotate1.originX.toString();
}
private function antirot(event:Event):void{
rotate2.end();angle -= 90;rotate2.play();
ll.text="antirot";
}
]]>
</mx:Script>
<mx:Rotate id="rotate1" angleFrom="{angle}" angleTo="{angle+90}" duration="0"
/>
<mx:Rotate id="rotate2" angleFrom="{angle}" angleTo="{angle-90}" duration="0"
/>
<mx:HSlider id="img_slider_smooth" value=".7" maximum="1.7"
minimum=".1" liveDragging="true" x="397" y="268"/>
<mx:Canvas id="mycanvas" x="373" y="24">
<mx:Image id="img" source="t3.jpg" scaleX="{img_slider_smooth.value}"
scaleY="{img_slider_smooth.value}" />
</mx:Canvas>
<mx:Button x="170" y="333" label="rButton" id="rButton"/>
<mx:Button x="341" y="333" label="arButton" id="arButton"/>
<mx:Text x="95" y="422" text="Text" id="ll"/>
</mx:Application>
|