zoukankan      html  css  js  c++  java
  • 通过greensock 的MaxLoader 获取外部swf的图片!

    通过greensock 的MaxLoader 获取外部swf的图片!

    package  {
        
        import com.greensock.loading.data.ImageLoaderVars;
        import com.greensock.loading.display.ContentDisplay;
        import com.greensock.loading.ImageLoader;
        import flash.display.Bitmap;
        import flash.display.BitmapData;
        import flash.display.Sprite;
        import flash.system.ApplicationDomain;
        import flash.system.LoaderContext;
        import flash.utils.getDefinitionByName;
        
        import com.greensock.events.LoaderEvent;
        import com.greensock.loading.LoaderMax;
        import com.greensock.loading.SWFLoader;
        
        import com.greensock.TweenLite;
        
        
        
        public class Main extends Sprite {
            
            
            public function Main() {
                // constructor code
                
                trace('this is use swf...');
                
                
                loadingSwf();
                
                
            }
            
            
            
            private var queue:LoaderMax;
            
            private function loadingSwf():void {
                
                trace('loadingSwf...');
                
                queue = new LoaderMax( { 
                    
                    name:'initStage',
                    requireWithRoot:root,
                    
                    onProgress:onProgressHander,
                    onComplete:onCompleteHandler,
                    onError:onErrorHander
                } );
                
                queue.maxConnections = 10;//最大线程
                
                //queue.append(new SWFLoader('swf/initStage1.swf',{name:'InitStage1',estimatedBytes:1457520 }));
                queue.append(new SWFLoader('swf/initStage2.swf',{name:'InitStage2',estimatedBytes:1457520 }));
                queue.append(new ImageLoader('swf/pic1.jpg', { name:'pic1', estimatedBytes:2400, x:100,y:0, height:400, 200, container:this, alpha:0.5,  scaleMode:"proportionalInside" } ));
                queue.load();
                
                
                
            }
            
            
            private function onProgressHander(e:LoaderEvent):void {
                
                //trace('InitStage.swf :: onProgress');
                trace('_>'+e.target.progress + '<___' +e.toString());
            }
                
            private function onCompleteHandler(e:LoaderEvent):void {
                
                trace('InitStage.swf :: onComplete');
                trace('_>' + e.target.progress + '<___' +e.toString());
                
                var image:ContentDisplay = LoaderMax.getContent('pic1');
                TweenLite.to(image, 6, { alpha:1, y:100 } );
                
                trace('pic1 :: onComplete');
                
                var context:SWFLoader = LoaderMax.getLoader('InitStage2');
                
                var oil:Class = context.getClass('icon_oil');
                trace('oil__'+ typeof oil);
                var oilbmd:BitmapData = new oil(0, 0) as BitmapData;
                var oilbmp:Bitmap = new Bitmap(oilbmd);
                oilbmp.x = 350;
                oilbmp.y = 260;
                 
                var cls:Class =  context.getClass('icon_new');
                var bmd:BitmapData = new cls(50, 100) as BitmapData;
                var bmp:Bitmap = new Bitmap(bmd);
                bmp.x = 150;
                bmp.y = 200;
                addChild(bmp);//*/
                 
                addChild(oilbmp);
                
                
            }
                
            private function onErrorHander(e:LoaderEvent):void {
                
                trace('InitStage.swf :: onError');
                trace(e.toString());
            }
            
            
            
            
            
            
            
        }
        
    }
  • 相关阅读:
    忽略大小写的RegularExpressionValidator
    Outlook 2010 “加载项执行错误。调用“Microsoft Exchange 加载项”加载项时,在“IDTExtensibility2”接口回调“OnConnection”期间,Outlook 出现故障”问题
    选择排序——算法系列
    代码杂记32
    数据库系统原理
    C#中的委托与事件
    C#多线程
    冒泡排序——算法系列
    快速排序——算法系列
    递归算法——猴子吃桃
  • 原文地址:https://www.cnblogs.com/didi/p/2464985.html
Copyright © 2011-2022 走看看