as3.0 loading...code
来源:互联网 发布:知百家传媒 编辑:程序博客网 时间:2024/06/05 10:02
/*********************************
AS3.0 LOADING CODE
**********************************/
stop();
stage.scaleMode=StageScaleMode.NO_SCALE;
//设置舞台属性不跟随播放器大小而改变
stage.showDefaultContextMenu=false;
//屏蔽右键菜单
stage.frameRate=30;
//设置帧频为30
var stageW=stage.stageWidth;
var stageH=stage.stageHeight;
//取得舞台宽和高
var loadclip:MovieClip=new MovieClip();
//创建LOADING MC loadclip
this.addChild(loadclip)
//添加loadclip到舞台
var txt=new TextField();
//创建文本文件 txt
txt.autoSize=TextFieldAutoSize.CENTER;
//文本文件自适应大小并且居中显示
txt.text="AS3.0 Loading...";
txt.textColor=0x000000;
//设置文本颜色
txt.selectable=false;
//文本设置为不可选
txt.x=stageW/2-txt.width/2;
txt.y=stageH/2-txt.height/2;
//设置本文件放置于舞台中央
loadclip.addChild(txt);
//将文本实例txt添加到loadclip
var stgb=new Sprite();
stgb.graphics.lineStyle(1,0x000000,1);
stgb.graphics.beginFill(0xff0000,.5);
//采用单色填充,红色透明50%(.5)
stgb.graphics.drawRect(0,0,200,10);
stgb.graphics.endFill();
stgb.x=stageW/2-stgb.width/2;
stgb.y=txt.y+txt.height+5;
loadclip.addChild(stgb)
//绘制进度条底色并且添加到loadclip
var stg=new Sprite();
stg.graphics.lineStyle(1,0x000000,.5);
stg.graphics.beginGradientFill(GradientType.LINEAR,[0xff0000,0xffff00],[100,100],[0,255]);
//采用渐变填充 红--黄
stg.graphics.drawRect(0,0,200,10);
stg.graphics.endFill();
stg.x=stageW/2-stg.width/2;
stg.y=txt.y+txt.height+5;
loadclip.addChild(stg)
//绘制进度条并且添加到loadclip
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS,loading);
//添加进度监听
this.loaderInfo.addEventListener(Event.COMPLETE,loaded);
//添加进度完成监听
function loading(eve) {
var loadpre:int=eve.bytesLoaded/eve.bytesTotal*100;
txt.text="影片载入"+loadpre+" %";
stg.scaleX=loadpre/100;
}
//显示进度载入百分比-----
function loaded(eve) {
txt.text="影片载入完毕!";
if (framesLoaded == totalFrames) {
removeChild(this.getChildAt(0));
nextFrame();
}
}
//载入完毕清除LOADING MC 下一帧播放音乐
- as3.0 loading...code
- AS3 loading
- AS3.0新手必读-影片Loading
- FLASH AS3 loading
- Flash AS3.0新手必读--影片Loading
- as3写的自身loading
- AS3文档类中的loading
- AS3 Code Libraries (APIs)
- AS3文档类中Loading的写法
- [知其然不知其所以然-34] micro code loading
- AS3 FLASH,加载外部swf的loading方法
- (OS X) Loading Code at Runtime
- Setting the Search Paths for Erlang Loading Code
- the design principles and code analysis of hibernate lazy loading
- Error while loading PyV8 binary:exit code 3
- RedHat AS3.0 配置
- AS3.0 MVC pattern
- as3.0 学习笔记
- 动态添加的控件(如TextView)如何居中?如何相对对齐?
- Vs2012 下基于Glut OpenGL开发环境建立
- C++变参函数和变参宏
- JAVA经典算法40题
- [C# 网络编程系列]专题七:UDP编程补充——UDP广播程序的实现
- as3.0 loading...code
- JAVA
- Mediator 中介者模式
- 多线程通信——信号量
- [C# 网络编程系列]专题八:P2P编程
- servlet下载文件文件
- 请随时记得基础要牢固
- semop: Resource temporarily unavailable解决方法
- Flyweight 享元模式