第一步:loader.load(new urlRequese(url));
第二步:监听
第三步:执行
private function onLoadComplement(evt:Event):void{
var boderMc:MovieClip = new (display.contentLoaderInfo.applicationDomain.getDefinition("chat") as Class);
this.addChild(boderMc)
}
问题来了,当将boderMc添加到stage当中后,boderMc的坐标是多少??
其实在制作swf文件的fla文件中就可以设置,选中某个影片剪辑,右键转换为元件,在“注册”选项中就可以设置影片剪辑中的那个点为stage中的(0,0)位置,如果设置为中,那boderMc添加到舞台后,会有一半的位置露在stage外面。如果设置为左上角,才会全部显示在stage中。
还有一个问题是,上面有一个似乎getDefinitioin(“chat”),这里的chat是一个影片剪辑的名字,在 元件列表栏(右下角)中找到该影片剪辑,然后右键 属性,找到 “为ActionScript导出”并选中,在 “类”填写框中写“chat”,这样我们就可以直接getDefinition("chat")方法来取出这个影片剪辑对象