控制as2 swf在as3中播放
我正在将 flash 8 中内置的 swf 嵌入到 as3 项目中。当我调用 stop() 或 gotoAndStop(0); 时在代表嵌入 swf 实例的 MovieClip 上,它会停止一秒钟,然后继续。尝试在 mc 上调用removeChild会将其从显示中删除,但 swf 中的音频继续播放。 swf,在这种情况下必须嵌入,我不能使用加载程序。任何想法
代码:
[Embed (source = "t1.swf")]
private var t1:Class;
private var mc:MovieClip;
public function iphoneTest()
{
var tf:TextField = new TextField();
tf.x = 10;
tf.y = 100;
tf.width = 100;
tf.height = 50;
tf.text = "Hello worl";
mc = new t1();
var button:CustomSimpleButton = new CustomSimpleButton();
button.width = 50;
button.height = 50;
button.x = 10;
button.y = 150;
button.addEventListener(MouseEvent.CLICK, onClick);
this.addChild(mc);
this.addChild(tf);
this.addChild(button);
}
private function onClick(e:MouseEvent):void {
mc.stop();
this.removeChild(mc);
}
I am embedding a swf built in flash 8 into an as3 project. When I call stop() or gotoAndStop(0); on the MovieClip that represents an instance of the embedded swf it stops for a sec and then continues. Trying to call removeChild on the mc removes it from the display but the audio in the swf keeps playing. The swf, in this case must be embedded, I cannot use loader. Any ideas
The code:
[Embed (source = "t1.swf")]
private var t1:Class;
private var mc:MovieClip;
public function iphoneTest()
{
var tf:TextField = new TextField();
tf.x = 10;
tf.y = 100;
tf.width = 100;
tf.height = 50;
tf.text = "Hello worl";
mc = new t1();
var button:CustomSimpleButton = new CustomSimpleButton();
button.width = 50;
button.height = 50;
button.x = 10;
button.y = 150;
button.addEventListener(MouseEvent.CLICK, onClick);
this.addChild(mc);
this.addChild(tf);
this.addChild(button);
}
private function onClick(e:MouseEvent):void {
mc.stop();
this.removeChild(mc);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你尝试过
mc = null;
吗?另外,由于您知道它是 as2 swf,因此可能应该使用
avm1movie
而不是MovieClip
did you try
mc = null;
?also since you know it's an as2 swf, should probably use
avm1movie
instead ofMovieClip
在最坏的情况下,您可以杀死 SWF 中的所有声音...
确保导入混音器类,然后杀死声音。
At very worst you can just kill all sounds in the SWF...
Make sure you import the sound mixer class then kill the sound..
如果您的 SWF 有任何层次结构,则需要递归遍历它以停止所有影片剪辑。
If your SWF has any hierarchy, you'll need to recurse through it to stop all movie clips.