使用Flex4畫圖形:圓、矩形、線(轉)

<?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">
    <s:layout>
        <s:BasicLayout/>
    </s:layout>
    <fx:Declarations>
        <!-- 將非可視元素(例如服務、值對象)放在此處 -->
    </fx:Declarations>
     
    <!-- 畫一個橢圓或圓 -->
    <s:Ellipse width="120" height="100" x="52" y="115">
        <s:fill>
            <s:SolidColor color="#ff0000" />
        </s:fill>
    </s:Ellipse>
     
    <!-- 畫一個紅色的橢圓或圓,描黑色的邊 -->
    <s:Ellipse width="120" height="100" x="48" y="224">
        <s:fill>
            <s:SolidColor color="#ff0000" />
        </s:fill>
        <s:stroke> 
            <s:SolidColorStroke color="0x000000" weight="2"/> 
        </s:stroke>
    </s:Ellipse>
     
    <!-- 畫一個空心的橢圓或圓,有黑色的邊 -->
    <s:Ellipse width="120" height="100" x="208" y="111">
        <s:stroke> 
            <s:SolidColorStroke color="0x000000" weight="1"/> 
        </s:stroke>
    </s:Ellipse>
     
    <!-- 畫一個長方形或正方形 -->
    <s:Rect width="100" height="80" x="432" y="134">
        <s:fill>
            <s:SolidColor color="#ff0000" />
        </s:fill> 
    </s:Rect>
     
    <!-- 畫一個紅色的直線 -->
    <s:Line width="238" x="200" y="80" >
        <s:stroke> 
            <s:SolidColorStroke color="0xff0000" weight="2"/> 
        </s:stroke> 
    </s:Line>
     
    <!-- 畫一個顏色漸變的直線 -->
    <s:Line width="238" x="200" y="100" >
        <s:stroke>
            <s:LinearGradientStroke weight="2">
                <s:GradientEntry color="#ff0000"/>
                <s:GradientEntry color="#ffff00"/>
            </s:LinearGradientStroke>
        </s:stroke>
    </s:Line>
     
</s:Application>

 

轉自:www.cnblogs.com/modou/articles/1900751.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章