我正在尝试在flash builder中使用图形api。
1)默认应用程序是"Main.as“(不是Main.mxml) 2)应用程序使用Spark (不是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
//***********************************
}
}
}发布于 2013-06-23 05:33:53
您的类必须扩展支持可视元素的类。
在本例中,您正在尝试扩展Spark Application类:
package
{
import spark.components.Application;
public class Main extends Application
{
public function Main()
{
super();
}
}
}https://stackoverflow.com/questions/17255398
复制相似问题