杠杆投资平台:flash中两点画直线,有要求。可加分

来源:百度文库 编辑:高考问答 时间:2024/05/05 18:38:28
先鼠标按下定一点,然后鼠标抬起,移动时画出线来,再按下鼠标确定另外一点成直线。可加分

this.createEmptyMovieClip("line_mc", this.getNextHighestDepth());
this.createEmptyMovieClip("lineTemp_mc", this.getNextHighestDepth());
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function()
{
this.isDrawing = true;
line_mc.lineStyle(2, 0xFF0000, 100);
line_mc.s_x = _xmouse;
line_mc.s_y = _ymouse;
};
mouseListener.onMouseMove = function()
{
if (this.isDrawing)
{
lineTemp_mc.clear();
lineTemp_mc.lineStyle(2, 0xFF0000, 100);
lineTemp_mc.moveTo(line_mc.s_x, line_mc.s_y);
lineTemp_mc.lineTo(_xmouse, _ymouse);
}
updateAfterEvent();
};
mouseListener.onMouseUp = function()
{
this.isDrawing = false;
line_mc.moveTo(line_mc.s_x, line_mc.s_y);
line_mc.lineTo(_xmouse, _ymouse);
};
Mouse.addListener(mouseListener);
stop();

Flash 8里通过...