如果容器被缩放,事件本身和它的子元素都不会改变宽度值,那么它们如何改变它们的宽度呢?
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
private function scaleOutContainer():void {
outerContainer.scaleX = slider.value;
trace("outerContainer.width: " + outerContainer.width);
trace("outerContainer.scaleX: " + outerContainer.scaleX);
trace("image width: " + fotoImig.width);
trace("image scaleX: " + fotoImig.scaleX);
var containerBound:Rectangle = outerContainer.getBounds(this);
trace(containerBound);
trace("=====================");
}
]]>
</fx:Script>
<s:Group id="outerContainer" left="50" top="80" width="500">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<s:BitmapImage id="fotoImig" source="@Embed('assets/foto.jpg')"/>
<s:Label id="info" text="Test Scale"/>
</s:Group>
<s:HGroup left="50" top="50">
<s:Label text="scale outContainer"/><s:HSlider id="slider" snapInterval="0.1" value="1" change="scaleOutContainer()"/>
</s:HGroup>
</s:Application>