首页 > 代码库 > [转] MovieClip转Bitmap方法
[转] MovieClip转Bitmap方法
1 package { 2 import flash.display.Bitmap; 3 import flash.display.BitmapData; 4 import flash.display.Loader; 5 import flash.display.LoaderInfo; 6 import flash.display.MovieClip; 7 import flash.display.Sprite; 8 import flash.display.StageAlign; 9 import flash.events.Event;10 import flash.net.URLRequest;11 import flash.system.System;12 public class test extends Sprite13 {14 private const FILE_PATH:String = "swf/2.swf";15 private const CLASS_NAME:String = "Ball";16 17 private var loader:Loader;18 private var request:URLRequest;19 20 public function test()21 {22 loader = new Loader();23 request = new URLRequest(FILE_PATH);24 loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);25 loader.load(request);26 this.stage.align=StageAlign.TOP_LEFT;27 28 }29 private function onComplete (event:Event):void {30 var loadedSWFInfo:LoaderInfo = event.target as LoaderInfo; 31 32 var loadedSWF:MovieClip = loadedSWFInfo.content as MovieClip;33 34 trace(loadedSWF.framesLoaded); 35 loadedSWF.stop();36 loadedSWF.x=0;37 loadedSWF.y=0;38 this.addChild(loadedSWF);39 trace(System.totalMemory);40 loadedSWF.cacheAsBitmap=true;41 //loadedSWF.getRect();42 var bitmap:BitmapData=http://www.mamicode.com/new BitmapData(loadedSWF.width,loadedSWF.height);43 44 loadedSWF.gotoAndStop(2);45 bitmap.draw(loadedSWF);46 var bb:Bitmap= new Bitmap(bitmap);47 this.addChild(bb);48 this.removeChild(loadedSWF);49 trace(System.totalMemory);50 } 51 }52 }
转载自:http://blog.sina.com.cn/s/blog_4c53883d0100a7jq.html
[转] MovieClip转Bitmap方法
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。