0

我真的不明白我做错了什么:这是一个简单的例子,但是当我点击按钮时没有任何反应..

<?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 drawLine():void 
        {
            var myShape:Shape = new Shape();
            myShape = new Shape() ;
            myShape.graphics.lineStyle(2, 0x990000, .75);
            myShape.graphics.moveTo(100, 100);

            myShape.graphics.lineTo(25, 45);
            this.addChild(myShape);
        }
    ]]>
</fx:Script>
<!--<mx:Label text="Hello World"/>-->
<mx:Button label="Click" click="drawLine()" />

</s:Application>
4

1 回答 1

1

用于SpriteVisualElement添加简单的非弹性对象。

<s:SpriteVisualElement width="500" height="500" id="spr"/>

spr.addChild(myShape)
于 2013-03-13T13:45:41.493 回答