WEB开发网
开发学院图形图像Flash [Actionscript][Away3D]三维图片展示Demo 阅读

[Actionscript][Away3D]三维图片展示Demo

 2009-03-03 11:58:46 来源:WEB开发网   
核心提示: Loader文档类:1package {2 /**//**3 * author: Aken li (http://www.kxbd.com)4 * date: 2009-03-035 */6 import flash.display.*;7 import flash.events.*;8

Loader文档类:

 1package {
 2    /**//**
 3     * author: Aken li (http://www.kxbd.com)
 4     * date: 2009-03-03
 5     */
 6    import flash.display.*;
 7    import flash.events.*;
 8    import flash.net.URLRequest;
 9    import flash.text.*;
10   
11    public class loader extends Sprite {
12        private var loadingText:TextField;
13        private var loadingUrl:String = 'Num08.swf';
14        private var myLoader:Loader;
15       
16        public function loader() {
17            makeText();
18            makeLoader();
19        }
20       
21        private function makeLoader() {
22            myLoader = new Loader();
23            myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadingProcess);
24            myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
25            myLoader.load(new URLRequest(loadingUrl));
26            addChild(myLoader);
27        }
28       
29        private function loadingProcess(e:ProgressEvent) {
30            var loadedPercent = Math.round(100 * e.bytesLoaded / e.bytesTotal);
31            loadingText.text = 'loaded ' + loadedPercent + '%';
32        }
33       
34        private function loaded(e:Event) {
35            removeChild(loadingText);
36            loadingText = null;
37        }
38       
39        private function makeText() {
40            var textFormat:TextFormat = new TextFormat();
41            textFormat.color = 0xFFFFFF;
42            loadingText = new TextField();
43            loadingText.x = stage.stageWidth/2-20;
44            loadingText.y = 10;
45            addChild(loadingText);
46            loadingText.defaultTextFormat = textFormat;
47        }
48    }
49   
50}

上一页  1 2 

Tags:Actionscript AwayD 三维

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接