Degrafa 贝塞尔样条线将数据绑定到字符串
我想通过以下代码将贝塞尔样条线插入我的画布:
<mx:Canvas
id="graphCanvas"
width="100%"
height="100%"
preinitialize="preInit()"
/>
<BezierSpline id="mySpline" graphicsTarget="{[graphCanvas]}" data="points"
verticalCenter =“0”horizontalCenter =“0” >
点是我在 preInit() 方法中初始化的字符串
[Bindable]public var points : String;
private function preInit() : void {
points = "200,100 200,300 100,300 300,500 500,300 400,300 400,100";
}
但是当我现在构建项目时,画布上没有绘制样条线,而直接将数据集成到 mxml 中
<BezierSpline id="mySpline" graphicsTarget="{[graphCanvas]}" data="200,100 200,300 100,300 300,500 500,300 400,300 400,100"
verticalCenter =“0”horizontalCenter =“0” >
有人能帮我吗? 我需要动态更改样条线的数据。 也欢迎以编程方式处理它的答案,因为我真的不知道如何通过代码在画布上重绘样条线(不知道如何使用样条线的 draw() 方法)。
预先感
谢塞巴斯蒂安
I want to insert a bezier spline into my Canvas by this code
<mx:Canvas
id="graphCanvas"
width="100%"
height="100%"
preinitialize="preInit()"
/>
<BezierSpline id="mySpline" graphicsTarget="{[graphCanvas]}" data="points"
verticalCenter="0" horizontalCenter="0"
>
points is a string I initialize in the preInit() method
[Bindable]public var points : String;
private function preInit() : void {
points = "200,100 200,300 100,300 300,500 500,300 400,300 400,100";
}
But when I now build the project no spline is drawn on my canvas whereas directly integrating the data in the mxml works
<BezierSpline id="mySpline" graphicsTarget="{[graphCanvas]}" data="200,100 200,300 100,300 300,500 500,300 400,300 400,100"
verticalCenter="0" horizontalCenter="0"
>
Can someone help me? I need to dynamically change the data of the spline. Also answers that handle it programmatically are welcome as I do not really know how to redraw the spline on my canvas by code (don't know how to use the draw() method of the spline).
Thanks in advance
Sebastian
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这段代码对我有用:
This code works for me: