加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

AS3 加载外部SWF资源

发布时间:2020-12-15 18:21:06 所属栏目:百科 来源:网络整理
导读:swf 内部库如下 ? Chat影片剪辑内有三个组建,TextArea,TextInput,Button,实例名非别是:textAtea,textInput,sendButton ? Main.as ? package{import flash.display.Loader;import flash.display.LoaderInfo;import flash.display.MovieClip;import flash.eve

swf 内部库如下

?

Chat影片剪辑内有三个组建,TextArea,TextInput,Button,实例名非别是:textAtea,textInput,sendButton

?

Main.as

?

package
{
	import flash.display.Loader;
	import flash.display.LoaderInfo;
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.net.URLRequest;
	
	
	
	public class Main extends MovieClip
	{
		
		
		public function Main()
		{
			
			var swfLoader:Loader = new Loader();
			var urlRequest:URLRequest = new URLRequest("asset.swf");
			swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,onComplete);
			swfLoader.load(urlRequest);
			
			
			
			
			
		}
		
		private function onComplete(e:Event):void{
			var l:LoaderInfo = e.target as LoaderInfo;
			var Chat:Class = l.applicationDomain.getDefinition("Chat") as Class;
			var chat:MovieClip = new Chat() as MovieClip;
			var sendButton:* = chat.getChildByName("sendButton");
			var textArea:* = chat.getChildByName("textArea");
			var textInput:* = chat.getChildByName("textInput");
			
			sendButton.label = "send";
			chat.x = 100;
			chat.y = 50;
			
			this.addChild(chat);
			
		}
		
		
	}
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读