在flex中画圆
我正在使用flex sdk并尝试绘制原始几何图形,以下代码有什么问题?我尝试在不触发(放置)按钮的情况下尝试,但没有成功。
<mx:Script>
import flash.display.Sprite;
import flash.display.Shape;
private function draw_circle():void
{
var myCircle:Shape = new Shape();
myCircle.graphics.beginFill(0x00000, 1);
myCircle.graphics.drawCircle(0, 0, 30);
addChild(myCircle);
}
</mx:Script>
<mx:Button x="30" y="0" name="circle" click= '{draw_circle()}'>
</mx:Button>
I'm using flex sdk and trying to draw primitive geometry figures, what is wrong in following code? i tried without the trigger(placing) of button, but did not work.
<mx:Script>
import flash.display.Sprite;
import flash.display.Shape;
private function draw_circle():void
{
var myCircle:Shape = new Shape();
myCircle.graphics.beginFill(0x00000, 1);
myCircle.graphics.drawCircle(0, 0, 30);
addChild(myCircle);
}
</mx:Script>
<mx:Button x="30" y="0" name="circle" click= '{draw_circle()}'>
</mx:Button>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要在
beginFill
之后endFill
:可以找到适当的文档 此处。
You need to
endFill
after youbeginFill
:Appropriate documentations could be found here.
另外...
如果您不指定 endFill(),您可能会遇到重要的内存问题,但仍然应该绘制圆圈
also...
If you don't specify endFill(), you're likely to run into important memory problems but the circle should still be drawn though