我正在开发加载动作脚本文件的 flex 应用程序。
<DrawingArea id="drawingArea" xmlns="*" width="100%" height="100%" add="drawingArea_addHandler(event)"/>
我需要动态添加它,怎么做?指导我
更新
这是我的绘图区如何创建var da:DrawingArea=new DrawingArea
如何访问监听功能?公共功能绘图区(){超();
addEventListener(FlexEvent.CREATION_COMPLETE, function(event:FlexEvent):void {
erase();
});
addEventListener(MouseEvent.MOUSE_DOWN, function(event:MouseEvent):void {
x1 = mouseX;
y1 = mouseY;
isDrawing = true;
});
addEventListener(MouseEvent.MOUSE_MOVE, function(event:MouseEvent):void {
if (!event.buttonDown)
{
isDrawing = false;
}
x2 = mouseX;
y2 = mouseY;
if (isDrawing)
{
graphics.lineStyle(2, drawColor);
graphics.moveTo(x1, y1);
graphics.lineTo(x2, y2);
x1 = x2;
y1 = y2;
}
});
addEventListener(MouseEvent.MOUSE_UP, function(event:MouseEvent):void {
isDrawing = false;
});
}