<!-- 一个在编写中的功能有类似的要求 于是写了个测试程序 比较简单 只能画方形 看了看fb4 发现里面已经有了绘图标签。。。感觉好底力-->
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:degrafa="http://www.degrafa.com/2007" backgroundColor="#eeeeee">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import com.degrafa.geometry.RoundedRectangle;
private var _rect:RoundedRectangle;
private function startDraw(e:MouseEvent):void
{
myrr.width = 0;
myrr.height = 0;
myrr.x = e.localX;
myrr.y = e.localY;
can.addEventListener(MouseEvent.MOUSE_MOVE,drawDraw);
}
private function drawDraw(e:MouseEvent):void
{
myrr.width = e.localX - myrr.x;
myrr.height = e.localY - myrr.y;
}
private function stopDraw(e:MouseEvent):void
{
can.removeEventListener(MouseEvent.MOUSE_MOVE,drawDraw);
}
]]>
</mx:Script>
<degrafa:Surface id="degrafaSurface" x="0" y="0">
<degrafa:fills>
<degrafa:SolidFill id="fillRed" color="#FFCC00" alpha="0.5" />
</degrafa:fills>
<degrafa:strokes>
<degrafa:SolidStroke id="strokeWhite" color="#FFFFFF" alpha="1" weight="1" />
</degrafa:strokes>
</degrafa:Surface>
<degrafa:RoundedRectangle id="myrr" graphicsTarget="{[can]}" stroke="{strokeWhite}" fill="{fillRed}" />
<mx:Canvas id="can" x="0" y="0" width="100%" height="100%" mouseDown="startDraw(event)" mouseUp="stopDraw(event)" />
</mx:Application>