错误#1009:无法访问NULL对象引用的属性或方法.[太沮丧]



请帮助我,我真的是菜鸟。

我只是找不到问题。在帧1中一切正常,但是当我单击下一个按钮时,出现错误。我已经检查了我使用过的所有按钮的实例名称,并且所有内容都已实例化。我只是不知道我还应该更改什么。Pausemusic2按钮已经存在。我也想知道为什么NextFrame();在Frame1中无法使用第54行。

错误

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at RECOVER_AGUILAREXERCISE_fla::MainTimeline/frame2()[RECOVER_AGUILAREXERCISE_fla.MainTimeline::frame2:21]
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at flash.display::MovieClip/nextFrame()
at RECOVER_AGUILAREXERCISE_fla::MainTimeline/nextSoundTrack01()[RECOVER_AGUILAREXERCISE_fla.MainTimeline::frame1:54]

框架2中的代码

stop();
 album01.gotoAndPlay(49);
 title2.play();
 import flash.media.SoundMixer;
 import flash.media.Sound;
 var sound02:Sound = new SITNight();
 var soundChannel02:SoundChannel = new SoundChannel
 var soundLastPosition02: Number = 0;

 soundChannel02 = sound02.play(0);

 pauseMusic2.pauseBTN.addEventListener (MouseEvent.CLICK, pauseSoundTrack02);
 function pauseSoundTrack02 (e:MouseEvent): void {
 pauseMusic2.visible = false;
 soundLastPosition02 = soundChannel02.position;
 soundChannel02.stop();
 }

 playMusic2.playBTN.addEventListener (MouseEvent.CLICK, playSoundTrack02);
 function playSoundTrack02 (e:MouseEvent): void {
 pauseMusic2.visible = true;
 soundChannel02 = sound02.play(soundLastPosition02);
 }

 stopMusic2.stopBTN.addEventListener (MouseEvent.CLICK, stopSoundTrack02);
 function stopSoundTrack02 (e:MouseEvent): void {
 pauseMusic2.visible = false;
 soundChannel02.stop();
 soundLastPosition02 = 0;
 }
 nextMusic2.nextBTN.addEventListener (MouseEvent.CLICK, nextSoundTrack02)
 function nextSoundTrack02 (e:MouseEvent): void {
 pauseMusic2.visible = true;
 soundChannel02.stop();
 soundLastPosition02 = 0;
 nextFrame();
 }
 prevMusic2.prevBTN.addEventListener (MouseEvent.CLICK, prevSoundTrack02)
 function prevSoundTrack02 (e:MouseEvent): void {
 pauseMusic2.visible = true;
 soundChannel02.stop();
 soundLastPosition02 = 0;
 gotoAndStop(1);
 }

您可以识别frame2中的第21行是哪个行?据我所知,我认为问题是" SoundChannel02"没有初始化。

可能是因为var soundChannel02:SoundChannel = new SoundChannel中缺少"()"如果不是错字。

相关内容

  • 没有找到相关文章

最新更新