华夏古月堂

stop();
var loader:Loader=new Loader(); //建立一个Loader对象
guzheng_btn.addEventListener(MouseEvent.CLICK,playguzheng); //对古筝按钮添加鼠标单击事件的侦听
function playguzheng(e:MouseEvent)
{
SoundMixer.stopAll(); //停止主swf文件中的背景音乐;
//loader.unloadAndStop(true);
loader.load(new URLRequest("古筝.swf")); //载入外部的“古筝.swf”文件
addChild(loader);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,oncomplete);
// 对使用myloader加载的信息进行完成事件的侦听
}
function oncomplete(e:Event)
{
var mc:MovieClip = e.currentTarget.content as MovieClip; //将载入的数据流放置在一个影片剪辑mc中
addChild(mc);
mc.x=20;
mc.y=80;
mc.addEventListener(Event.ENTER_FRAME,listenFrame); //监听载入的SWF播放
}
function listenFrame(e:Event)
{
if(e.currentTarget.currentFrame == e.currentTarget.totalFrames) //判断当前事件的目标(mc)是否播放到最后一帧
e.currentTarget.stop();
}
浙公网安备 33010602011771号