即拷即用的loading代码 |
| 作者:佚名 来源:不详 更新:2007-1-13 20:36:52 错误报告 我要投稿 |
放在第1帧即可。enjoy!
stop(); var rect1:MovieClip = createRectangle1(150, 3, 0x000000); var rect2:MovieClip = createRectangle2(152, 5, 0x000000); rect1._x = (Stage.width - rect1._width) / 2; rect1._y = (Stage.height - rect1._height) / 2; rect2._x = (Stage.width - rect2._width) / 2; rect2._y = (Stage.height - rect2._height) / 2; onEnterFrame = function () { rect1._width = _root.getBytesLoaded() / _root.getBytesTotal() * 150; if (_root.getBytesLoaded() == _root.getBytesTotal()) { rect1.removeMovieClip(); rect2.removeMovieClip(); delete rect1; delete rect2; delete createRectangle1; delete createRectangle2; delete onEnterFrame; play(); } }; function createRectangle1(width:Number, height:Number, color:Number, scope:MovieClip):MovieClip { scope = (scope == undefined) ? this : scope; var depth:Number = scope.getNextHighestDepth(); var mc:MovieClip = scope.createEmptyMovieClip("mc_" + depth, depth); mc.beginFill(color); mc.lineTo(0, height); mc.lineTo(width, height); mc.lineTo(width, 0); mc.lineTo(0, 0); return mc; } function createRectangle2(width:Number, height:Number, color:Number, scope:MovieClip):MovieClip { scope = (scope == undefined) ? this : scope; var depth:Number = scope.getNextHighestDepth(); var mc:MovieClip = scope.createEmptyMovieClip("mc_" + depth, depth); mc.lineStyle(color); mc.moveTo(0, 0); mc.lineTo(0, height); mc.lineTo(width, height); mc.lineTo(width, 0); mc.lineTo(0, 0); return mc; }
|
|
| 文章录入:skyuu 责任编辑:skyuu |
|
| 【字体:小 大】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 |