0

所以这是一个项目的延续... 1021: Duplicate function definition in my action Script

我正在制作一个交互式 Flash 项目......它有 17 个独立的场景......

介绍场景“Main_Sequence” 15 个单独的标题歌曲页面....

介绍场景播放,然后默认(无编码)跳转到“Main_Sequence”..

在“Main_Sequence”中,有一个动画应该播放(之前工作正常),然后整个序列应该在它被钓到后“停止”(不确定在哪里实现stop();,所以它不会进入下一个场景)

然后,当您将鼠标悬停在屏幕上的每个音符上时,它就会产生鼠标悬停效果....当您单击歌曲标题时,您应该“跳转”到标记为该歌曲的特定场景,而该场景又带有主页按钮你回...

感谢@George Profenza 帮助我获取按钮工作的代码(?)......我说(?)因为当我去测试电影时,它会加载并播放介绍......跳转到主要序列然后播放动画的前两部分,然后冻结并显示以下输出错误TypeError: Error #1009: Cannot access a property or method of a null object reference。在 music_Sheet_project_15_fla::MainTimeline/frame91()[music_Sheet_project_15_fla.MainTimeline::frame91:18]

我了解以下关于 1009 的内容,这主要意味着有代码试图访问一个不再存在或尚不存在的对象......唯一的问题是我除了两个补间动画之外什么都没有框架......并且在我的操作代码中没有引用 91 帧/这些图层上没有代码...... http://s22.postimg.org/qdoja6xnl/Untitled_picture3.png我需要的第一帧访问按钮(歌曲标题是在所有动画加载后,即帧#525)

...最后是那个主要场景的代码

  var buttonMap:Dictionary = new Dictionary();
  buttonMap["TD_g"] = "Tweedlee_Dee";
  buttonMap["s_g"] = "Sincerely";
  buttonMap["ats_g"] = "Ain’_that_a_shame";
  buttonMap["iyk_g"] = "I_hear_you_knocking";
  buttonMap["hms_g"] = "Hearts_made_of_stone";
  buttonMap["tf_g"] = "Tutti_fruiti";
  buttonMap["hd_g"] = "Hound_Dog";
  buttonMap["ld_g"] = "Little_darlin";
  buttonMap["ll_g"] = "Louie_Louie";
  buttonMap["ts_g"] = "Twist_and_shout";
  buttonMap["ipsy_g"] = "I_put_a_spell_on_you";
  buttonMap["ysm_g"] = "You_shook_me";
  buttonMap["ihm_g"] = "I_can_hear_music";
  buttonMap["iss_g"] = "I_shot_the_sheriff";
  buttonMap["tl_g"] = "Tainted_love";

  TD_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
  s_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
  ats_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
  iyk_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
  hms_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
  tf_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
 hd_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
 ld_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
 ll_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
 ts_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
 ipsy_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
 ysm_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
 ihm_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
 iss_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
 tl_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);

function mouseDownHandler(event:MouseEvent):void {
gotoAndStop(1, buttonMap[event.currentTarget.name]);
}

是否有可能是因为歌曲标题按钮是位图并且仅成为“按钮”@Frame 525 导致错误。如果是这种情况,为什么它不会为前两个也仅成为按钮的歌曲标题提供错误@Frame525 ?

如果我无法通过输出错误,我将无法测试按钮的功能.. 一些帮助/建议将不胜感激!!!

4

1 回答 1

0

所以看起来,通过将动作脚本放置在第 525 帧的自己的图层中,而不是将其放在@Frame 1 的图层中......问题现在解决了......但是 30 个按钮中有 5 个不起作用我将排除故障....从中得出的结论是,您的 Actionscript 在时间轴中的位置至关重要!

于 2013-04-15T02:58:58.150 回答