【发布时间】:2020-06-28 15:27:39
【问题描述】:
我制作了三张拉到其他三张的照片,并且成功完成了。 想加个加强音,如果附件被正确的拉住,另外一个声音表示操作不成功的时候不满意, 问题:一次成功后,Booster 仍然可以在所有图像上工作,并且失败声音不起作用。 也就是说,我无法正确地制定符号来控制库内部的声音以使其正常工作。 请帮忙解决问题
在代码中: 被拉取的图像名称(r1,r2,r3),静止图像的名称(m1,m2,m3),成功的声音mus1和失败的声音mus2
////////////////
stop();
r1.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
function fl_ClickToDrag(event:MouseEvent):void
{
r1.startDrag();
}
stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
function fl_ReleaseToDrop(event:MouseEvent):void
{
r1.stopDrag();
if(r1.hitTestObject(m1))
{
r1.x=m1.x
r1.y=m1.y
}
else
{
r1.x=30.05
r1.y=155.95
}
}
r2.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_2);
function fl_ClickToDrag_2(event:MouseEvent):void
{
r2.startDrag();
}
stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_2);
function fl_ReleaseToDrop_2(event:MouseEvent):void
{
r2.stopDrag();
if(r2.hitTestObject(m2))
{
r2.x=m2.x
r2.y=m2.y
///////////////Sound code for reinforcement
var musAPlay:Ahsant = new Ahsant();
var musA1Channel:SoundChannel = new SoundChannel();
SoundMixer.stopAll();
musA1Channel.stop();
musA1Channel = musAPlay.play();
}
else
{
r2.x=30.05
r2.y=249.4
//////////////Sound code not being successful
var musBPlay:noah = new noah();
var musB1Channel:SoundChannel = new SoundChannel();
SoundMixer.stopAll();
musB1Channel.stop();
musB1Channel = musBPlay.play();
}
}
r3.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_3);
function fl_ClickToDrag_3(event:MouseEvent):void
{
r3.startDrag();
}
stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_3);
function fl_ReleaseToDrop_3(event:MouseEvent):void
{
r3.stopDrag();
if(r3.hitTestObject(m3))
{
r3.x=m3.x
r3.y=m3.y
}
else
{
r3.x=30.05
r3.y=347.4
}
if(r1.hitTestObject(m1)&& r2.hitTestObject(m2) && r3.hitTestObject(m3))
gotoAndPlay (5)
}
//////////////////////////
【问题讨论】:
标签: mute