【发布时间】:2015-10-23 10:41:30
【问题描述】:
我是 as3 的新手。我收到此错误:
与命名空间内部的定义事件存在冲突。
我使用相同的编码但不同的场景。我换了第二个场景。
var mysound:bila =new bila()
这是我第一个场景的代码,只在第一个场景中成功:
var isItPlaying:Boolean = true;
var lastposition:Number = 0;
var mysound:izhar = new izhar();
var soundchannel:SoundChannel = new SoundChannel();
soundchannel = mysound.play(0,0);// playing sound in the channel
soundchannel.addEventListener(Event.SOUND_COMPLETE, onPlaybackComplete1);
function onPlaybackComplete1(event:Event):void
{
lastposition = 0;
soundchannel.stop();
btn.btn_pause.visible = false;
trace("finished");
isItPlaying=false;
}
/************end of part 1********/
btn.addEventListener(MouseEvent.CLICK, playsound);*
function playsound(event:MouseEvent):void*
{
if (! isItPlaying)
{
soundchannel = mysound.play(lastposition,0);
btn.btn_pause.visible = true;
isItPlaying = true;
}
else
{
lastposition = soundchannel.position;
soundchannel.stop();
btn.btn_pause.visible = false;
/*trace(lastposition.toFixed(0), mysound.length.toFixed(0));*/
isItPlaying = false;
}
soundchannel.addEventListener(Event.SOUND_COMPLETE, onPlaybackComplete);*
function onPlaybackComplete(event:Event):void
{
lastposition = 0;
soundchannel.stop();
btn.btn_pause.visible = false;
trace("finished");
isItPlaying=false;
}
}
【问题讨论】:
-
您是否在代码顶部导入任何包?
标签: actionscript-3 flash