flash画swf文件

package Src.Tool
{
	import flash.display.Loader;
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.net.URLRequest;
	public class Swfer extends Sprite
	{
		private var m_Loader:Loader = null;
		private var m_InitFun:Function = null;
		private var m_szUrl:String = null;
		public var m_Swf:MovieClip = null;
		public function Swfer(_szUrl:String, _funInit:Function = null)
		{
			// constructor code
			m_szUrl = _szUrl
			m_InitFun = _funInit;
			m_Loader = new Loader();
			m_Loader.load(new URLRequest(m_szUrl));
			m_Loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
		}
		private function onComplete(_evt:Event):void  
        {  
            m_Swf = _evt.target.content as MovieClip;  
			if( null == m_Swf)
			{
			 	trace("下载" + m_szUrl + "文件失败!");
			}
			m_Loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onComplete);
			m_Loader = null;
			if( null != m_InitFun)
			{
				m_InitFun();
				m_InitFun = null;
			}
        }
		public function drawSwf(_Scene:Sprite)
		{
			if( null != m_Swf)
			{
				_Scene.addChild(m_Swf);
			}
		}
	}
}

 

你可能感兴趣的:(flash画swf文件)