游戏设计笔记 :预加载
- stop();
- addEventListener(Event.ENTER_FRAME, loadProgress);
- function loadProgress(event:Event) {
- // get bytes loaded and bytes total
- var movieBytesLoaded:int = this.root.loaderInfo.bytesLoaded;//加载量
- var movieBytesTotal:int = this.root.loaderInfo.bytesTotal;//加载总量
- // convert to KiloBytes
- var movieKLoaded:int = movieBytesLoaded/1024;
- var movieKTotal:int = movieBytesTotal/1024;
- progressText.text = "Loading: "+movieKLoaded+"K/"+movieKTotal+"K";
- if (movieBytesLoaded >= movieBytesTotal) {
- removeEventListener(Event.ENTER_FRAME, loadProgress);
- gotoAndStop(2);
- }
-
100) ? false:true" x-data="topBtn" @click="scrolltoTop" x-cloak>