理性思考Flash与Ajax相关问题
点击次数:41 次 发布日期:2008-11-21 23:37:32 作者:源代码网
|
下面的测试程序的代码,在测试的时候打开任务管理器,安下鼠标连续的长时间绘制,可以看到任务管理器中cpu的使用情况. //----------------
count = 0; mcs = []; _root.onMouseDown = function() { if (_root._ymouse>335) { return; } _root.draw = true; _root.drawmc = _root.createEmptyMovieClip("a"+++count, count); _root.drawmc.moveTo(_root._xmouse, _root._ymouse); mcs.push(_root.drawmc); t = getTimer(); }; var t; _root.onMouseMove = function() { if (_root.draw) { if (getTimer()-t>3000) { _root.onMouseDown(); trace("new mc..."); } _root.drawmc.lineStyle(2, 0, 100); // if (_root._ymouse>335) { ymouse = 335; } else { ymouse = _root._ymouse; } _root.drawmc.lineTo(_root._xmouse, ymouse); } }; _root.onMouseUp = function() { _root.draw = false; }; clear.onRelease = function() { trace(mcs); for (var i in mcs) { mcs[i].removeMovieClip(); } mcs = []; count = 1; }; 源代码网供稿. |
