我正在使用带有图像视图的Flash构建器开发android和iPhone应用程序,但是每当我通过捏缩放来测试我在galaxy s3或iPhone上的应用时,我都无法保持宽高比(图像高度和宽度),同时它在galaxy s2上运行良好。
我正在使用此代码..
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:com="com.*">
<fx:Script>
<![CDATA[
[Embed(source="assets/image.jpg")]
[Bindable]
public var desertImage:Class;
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:titleContent>
<s:Label color="#FFFFFF" fontWeight="bold" fontSize="25" text="Districts"/>
</s:titleContent>
<s:Group id="parentContaner" width="100%" height="100%" >
<com:GestureImage x="1" y="2" width="{this.width}" height="{this.height}" source="{desertImage}" smooth="true" scaleMode="letterbox" />
</s:Group>
</s:View>
gestureimage.as捏缩放功能..
private function onGesturePinch(pinchEvent:TransformGestureEvent):void{
setAsCurrentChild();
var pinchMatrix:Matrix = this.transform.matrix;
var pinchPoint:Point =
pinchMatrix.transformPoint(
new Point((this.width/2), (this.height/2)));
pinchMatrix.translate(-pinchPoint.x, -pinchPoint.y);
pinchMatrix.scale(pinchEvent.scaleX, pinchEvent.scaleY);
pinchMatrix.translate(pinchPoint.x, pinchPoint.y);
this.transform.matrix = pinchMatrix;
}