我的孩子swf的时间轴,其中有特定声音文件的图层与我的动画同步。现在当我尝试使用加载器将此swf导入到我的主Flash网站时,问题出现了,并且每次在父级中单击按钮时声音将持续播放。我的问题是如何让声音完全清除,并在每次点击按钮将孩子加载到父母中的加载器时从子swf的第0帧重新启动。
var myLoader:Loader = new Loader();// create a new instance of the Loader class
var project1:URLRequest=new URLRequest("Projects/Q1/Flash_Projects/Greeting_Card/GreetingCard.swf");
var project2:URLRequest=new URLRequest("Projects/Q1/Flash_Projects/Landscape/Landscape.swf");
var project3:URLRequest=new URLRequest("Projects/Q1/Flash_Projects/SpaceInvadersTribute/Main.swf");
var project4:URLRequest=new URLRequest("Projects/Q1/Flash_Projects/RandomImageProducer/RndImgProd.swf");
//var project5:URLRequest = new URLRequest("Projects/Q1/Flash_Projects/Tutorial/Main.swf");
var project6:URLRequest=new URLRequest("Projects/Q1/Flash_Projects/Soundboard/Main.swf");
btnQ1P1.addEventListener(MouseEvent.CLICK,Greeting);
btnQ1P2.addEventListener(MouseEvent.CLICK,landscape);
btnQ1P3.addEventListener(MouseEvent.CLICK, tribute);
btnQ1P4.addEventListener(MouseEvent.CLICK, slideshow);
//btnQ1P5.addEventListener(MouseEvent.CLICK, tutorial);
btnQ1P6.addEventListener(MouseEvent.CLICK, soundboard);
addChild(myLoader);
function Greeting(event:MouseEvent):void {
SoundMixer.stopAll();
myLoader.load(project1);
myLoader.x=550;
myLoader.y=130;
}
//Errors with Sound clips
function landscape(event:MouseEvent):void {
SoundMixer.stopAll();
myLoader.load(project2);
myLoader.x=440;
myLoader.y=130;
}
function tribute(event:MouseEvent):void {
SoundMixer.stopAll();
myLoader.load(project3);
myLoader.x=550;
myLoader.y=170;
}
//Errors with slideshow Code!
function slideshow(event:MouseEvent):void {
SoundMixer.stopAll();
myLoader.load(project4);
myLoader.x=530;
myLoader.y=130;
}
//function tutorial(event:MouseEvent):void{
//SoundMixer.stopAll();
//myLoader.unload();
//myLoader.load(project5);
//myLoader.x = 440;
//myLoader.y = 130;
//}
function soundboard(event:MouseEvent):void {
SoundMixer.stopAll();
myLoader.load(project6);
myLoader.x=550;
myLoader.y=130;
}
答案 0 :(得分:1)
我遇到了同样的问题。
您需要将声音从“事件”更改为“流”。在Flash Professional中,可以从时间轴上声音的属性选项卡访问它。单击声音,然后转到“属性”选项卡,将类型从“事件”更改为“流”。
现在,当时间线停止时声音会停止。