Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 Actionscript 3删除swf音频不会停止_Actionscript 3 - Fatal编程技术网

Actionscript 3 Actionscript 3删除swf音频不会停止

Actionscript 3 Actionscript 3删除swf音频不会停止,actionscript-3,Actionscript 3,我正在尝试为游戏剪辑场景添加swf,但在removeChild之后音频重复出现问题,并将对象设置为null。我试图在动画(721)中的帧长度之后添加文件并将其删除,然后将其删除以继续其他内容 我也尝试过剪接场景[0]。停止();和SoundMixer.stopAll();正如其他员额所建议的那样 removechild()确实会删除文件/动画的视觉效果,但不会删除音频,并且会在动画长度(721帧)的一段时间后重复,就像正在重新加载一样。如何停止音频 package { import fl

我正在尝试为游戏剪辑场景添加swf,但在removeChild之后音频重复出现问题,并将对象设置为null。我试图在动画(721)中的帧长度之后添加文件并将其删除,然后将其删除以继续其他内容

我也尝试过剪接场景[0]。停止();和SoundMixer.stopAll();正如其他员额所建议的那样

removechild()确实会删除文件/动画的视觉效果,但不会删除音频,并且会在动画长度(721帧)的一段时间后重复,就像正在重新加载一样。如何停止音频

    package {
import flash.display.*;
    import flash.media.*;
    import flash.utils.*;
                import flash.events.*;
   [SWF(backgroundColor="#0000ff", frameRate="24", width="640", height="480")]
public class main extends MovieClip
{
    [Embed(source="/Cutscenes/Intro_Scene 1.swf")]
    private var scene1:Class
    public var cutscenes:Array = new Array();
    public var scene_exists:Boolean = false;
    public var scene_timer:Number = 0;
    public function main()
    {
        scene_exists = false;
        addEventListener(Event.ENTER_FRAME, play_intro);
    }

    public function play_intro(event:Event):void
    {
        scene_timer++;
        if (scene_exists == false) //Add cutscene
        {
            cutscenes[0] = new scene1();
            addChild(cutscenes[0]);
            scene_exists = true;
        }

        if (scene_timer == 721) //Remove cutscene
        {
            SoundMixer.stopAll();
            scene_exists = false;
            removeChild(cutscenes[0]);
            cutscenes[0] = null;
            scene_timer = 0;
            removeEventListener(Event.ENTER_FRAME, play_intro);
                            //Do next thing
        }
    }
}

}

不确定这是否是问题所在,但请尝试像这样停止剪切场景:

 cutscenes[0].stop();
然后执行
SoundMixer.stopAll()

我的想法是.swf的时间表将继续播放,甚至重复,如果不停止


从显示列表中删除DisplayObject并不会停止播放动画/音频,只是将其从显示列表中删除。

您是否尝试过通过Loader类加载SWF而不是直接嵌入它,然后在Loader上调用unloadAndStop方法?注意,如果需要嵌入数据而不是在运行时加载数据,则可以嵌入SWF的字节,并通过loadBytes方法手动将它们输入到加载程序中。