0
我真不明白我在做什麼錯: 很簡單的例子,但是當我按一下按鈕沒有任何反應..添加簡單的非繪製線在ActionScript
<?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>
嘗試給一個MyShape的高度和寬度 – JeffryHouser 2013-03-13 13:01:16
使用[行](http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/primitives/Line.html);更容易。 – RIAstar 2013-03-13 14:38:28