| <?xml version="1.0" encoding="utf-8"?>
|
| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| |
| --> |
| <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/halo" viewSourceURL="srcview/index.html">
|
| <s:layout>
|
| <s:BasicLayout/>
|
| </s:layout>
|
|
|
| <fx:Script>
|
| <![CDATA[
|
|
|
| private function addMatrix(): void
|
| {
|
| ellipse1.transform.matrix = rotation20Matrix;
|
| descriptionText.text = "A matrix transform was applied moving the Ellipse to coordinates: 100, 110 and skewing it to a 20 degree rotation.";
|
| trace(ellipse1.width);
|
| }
|
| ]]>
|
| </fx:Script>
|
| <fx:Declarations>
|
| <!-- This matrix should cause the rotation of the Ellipse be 20 degrees -->
|
| <s:Matrix id="rotation20Matrix"
|
| a="0.939692620786"
|
| b="0.34202014332"
|
| c="0.34202014332"
|
| d="0.939692620786"
|
| tx="100"
|
| ty="70"
|
| />
|
| </fx:Declarations>
|
|
|
| <s:Panel width="100%" height="100%"
|
| title="An Ellipse Using a Transform for Rotation"
|
| skinClass="skins.TDFPanelSkin">
|
| <s:Label width="250" verticalAlign="justify" color="#323232" x="10" y="30"
|
| text="The Matrix class represents a transformation matrix that determines how to
|
| map points from one coordinate space to another. You can perform various graphical transformations on
|
| a display object by setting the properties of a Matrix object, applying that Matrix object to the matrix
|
| property of a Transform object, and then applying that Transform object as the transform property of the display object. These transformation functions include translation (x and y repositioning), rotation, scaling, and skewing."/>
|
|
|
| <s:Label id="descriptionText" right="100" y="20" width="250"/>
|
| <s:Ellipse id="ellipse1" width="60" height="70" right="217" y="69">
|
| <s:fill>
|
| <s:LinearGradient>
|
| <s:GradientEntry color="#336699" alpha="1" ratio="0"/>
|
| <s:GradientEntry color="#000000" alpha="0" ratio="1"/>
|
| </s:LinearGradient>
|
| </s:fill>
|
| <s:stroke>
|
| <mx:SolidColorStroke color="0x666666" weight="1"/>
|
| </s:stroke>
|
| </s:Ellipse>
|
| <s:Button label="Apply Transform" click="addMatrix()" bottom="30" horizontalCenter="100"/>
|
|
|
| </s:Panel>
|
| </s:Application>
|