0
我正嘗試在Flash Builder中使用圖形api。無法在Flash Builder中使用addElement
1)默認的應用程序是「Main.as」(不Main.mxml) 2)應用程序使用星火(不mx包)
我所看到的是使用功能的addElement顯示在下面的代碼
這裏形狀的代碼:
package app
{
import flash.display.Shape;
import flash.display.Sprite;
import spark.core.SpriteVisualElement;
public class Main
{
public function Main()
{
var shape:Shape =new Shape() ;
shape.graphics.lineStyle(3,0xff);
shape.graphics.moveTo(0,0);
shape.graphics.lineTo(300,300);
var sve:SpriteVisualElement = new SpriteVisualElement() ;
sve.addChild(shape);
//***********************************
addElement(sve) ;// <<< Compiler error here
//***********************************
}
}
}
好的,謝謝。但現在我得到了這裏提到的錯誤:http://stackoverflow.com/questions/15972818/create-actionscript-application-file-for-flex-project。解決方案打勾..但我不想使用「mxml」作爲默認應用程序。我需要使用「.as」文件作爲默認應用程序。 –
Flex主應用程序文件必須是MXML。你在使用Flex的功能嗎?如果沒有,請根據需要創建一個純粹的ActionScript項目和鏈接庫。 –
flex有什麼特點?我不打算使用Flex中的組件。我只想使用「spark」包,用於基本繪製API。這一切。 –