1 Package {2 ImportFlash.display.Bitmap;3 ImportFlash.display.BitmapData;4 ImportFlash.display.Loader;5 ImportFlash.display.LoaderInfo;6 ImportFlash.display.MovieClip;7 ImportFlash.display.Sprite;8 Importflash.display.StageAlign;9 Importflash.events.Event;Ten Importflash.net.URLRequest; One ImportFlash.system.System; A Public classTestextendsSprite - { - PrivateConst FILE_PATH:STRING ="swf/2.swf"; the PrivateConst CLASS_NAME:STRING ="Ball"; - - Private varLoader:loader; - Private varrequest:urlrequest; + - Public functionTest () + { ALoader =NewLoader (); atRequest =Newurlrequest (file_path); - Loader.contentLoaderInfo.addEventListener (Event.complete, oncomplete); - loader.load (request); - This. stage.align=Stagealign.top_left; - - } in Private functionOnComplete (event:event):void { - varLoadedswfinfo:loaderinfo =Event.target as Loaderinfo; to + varLOADEDSWF:MovieClip= Loadedswfinfo.content ASMovieClip; - the Trace (loadedswf.framesloaded); * loadedswf.stop (); $Loadedswf.x=0;Panax NotoginsengLoadedswf.y=0; - This. AddChild (loadedswf); the Trace (system.totalmemory); +loadedswf.cacheasbitmap=true; A //Loadedswf.getrect (); the varBitmap:bitmapdata=NewBitmapData (loadedswf.width,loadedswf.height); + -Loadedswf.gotoandstop (2); $ Bitmap.draw (loadedswf); $ varbb:bitmap=NewBitmap (Bitmap); - This. AddChild (BB); - This. RemoveChild (loadedswf); the Trace (system.totalmemory); - } Wuyi } the}
Reprinted from: http://blog.sina.com.cn/s/blog_4c53883d0100a7jq.html
[Turn] MovieClip to bitmap method