【问题标题】:AS3: returning to a scene in the main timeline from an embedded moveclipAS3:从嵌入的移动剪辑返回到主时间轴中的场景
【发布时间】:2012-11-04 00:39:19
【问题描述】:

所以基本上,我有一个名为 homeButton 的影片剪辑,嵌入在另一个名为 overlay 的影片剪辑中。此叠加层放置在电影中的每个场景上。我想要发生的是,当从任何场景中单击 homeButton 时,返回到场景“floorSelect”

在覆盖符号内,我有动作脚本:

homeButton.addEventListener(MouseEvent.CLICK, homeButtonClicked);

function homeButtonClicked(e:MouseEvent):void
{
    parent.gotoAndPlay(1, "floorSelect");
}

我猜我的错误是在 gotoAndPlay 中,我试过了:

root.gotoAndPlay(1, "floorSelect");
parent.parent.gotoAndPlay(1, "floorSelect");

提前致谢, J

【问题讨论】:

  • 我也收到错误:Symbol 'overlay', Layer 'as', Frame 1, Line 21 1061: Call to a possibly undefined method gotoAndPlay through a reference with static type flash.display:DisplayObjectContainer.

标签: actionscript-3 flash


【解决方案1】:

你试过这些吗?

MovieClip(root).gotoAndPlay(1,'floorSelect');
// or
MovieClip(parent).gotoAndPlay(1,'floorSelect');

【讨论】:

  • 绝对完美。非常感谢。一个简单的问题,如果你从 floorSelect 场景按下 homeButton,是否有阻止它进入下一个场景?或禁用该特定场景中的按钮。
  • 别担心,我已经想通了。我只是使用'gotoAndStop()' 来确保它不会继续。再次感谢您的帮助@inhan
  • 没问题。确保从正确的范围调用 gotoAndPlay/Stop。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-08-23
  • 2011-01-15
  • 1970-01-01
  • 1970-01-01
  • 2021-03-20
  • 1970-01-01
  • 2011-08-10
相关资源
最近更新 更多