FlashAS:即拷即用的loading代码

王朝other·作者佚名  2008-05-19
窄屏简体版  字體: |||超大  

放在第1帧即可。enjoy!

stop();

varrect1:MovieClip=createRectangle1(150,3,0x000000);

varrect2: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();

deleterect1;

deleterect2;

deletecreateRectangle1;

deletecreateRectangle2;

deleteonEnterFrame;

play();

}

};

functioncreateRectangle1(width:Number,height:Number,color:Number,scope:MovieClip):MovieClip{

scope=(scope==undefined)?this:scope;

vardepth:Number=scope.getNextHighestDepth();

varmc: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);

returnmc;

}

functioncreateRectangle2(width:Number,height:Number,color:Number,scope:MovieClip):MovieClip{

scope=(scope==undefined)?this:scope;

vardepth:Number=scope.getNextHighestDepth();

varmc: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);

returnmc;

}

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航