xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark">
import mx.geom.TransformOffsets;
// Define an instance of TransformOffsets.
private var myXForm:TransformOffsets = new TransformOffsets();
// Initialize the postLayoutTransformOffsets property of the target.
private function initOffsets():void {
targetImg.postLayoutTransformOffsets = myXForm;
}
// Move the target 20 pixels to the left and
// increase its x and y scale by 0.1.
private function nudgeImageLeft():void {
targetImg.postLayoutTransformOffsets.x =
targetImg.postLayoutTransformOffsets.x - 20;
targetImg.postLayoutTransformOffsets.scaleX =
targetImg.postLayoutTransformOffsets.scaleX + 0.1;
targetImg.postLayoutTransformOffsets.scaleY =
targetImg.postLayoutTransformOffsets.scaleY + 0.1;
}
// Move the target 20 pixels to the right and
// decrease its x and y scale by 0.1.
private function nudgeImageRight():void {
targetImg.postLayoutTransformOffsets.x =
targetImg.postLayoutTransformOffsets.x + 20;
targetImg.postLayoutTransformOffsets.scaleX =
targetImg.postLayoutTransformOffsets.scaleX - 0.1;
targetImg.postLayoutTransformOffsets.scaleY =
targetImg.postLayoutTransformOffsets.scaleY - 0.1;
}
// Reset the transform.
private function resetImage():void {
targetImg.postLayoutTransformOffsets.x = 0;
targetImg.postLayoutTransformOffsets.scaleX = 1.0;
targetImg.postLayoutTransformOffsets.scaleY = 1.0;
}
creationComplete="initOffsets();" />