Flash actionscript 3.0 如何根据先前场景中的按钮转到特定场景?
Flash actionscript 3.0 How to go to an specific scene based on a button from an earlier scene?
所以我做了4个场景。在第一个场景中有 2 个按钮,它们都用于下一个场景。在下一个场景中还有另一个按钮,但是根据您在第一个场景中单击的按钮,您会转到下一个场景。
让我们说得更清楚:
场景 1:Button1 和 Button2
场景 2:按钮
场景 3:基于 Button1 的结果
场景 4:基于 Button2 的结果
这是我得到的:
场景 1:
button1.addEventListener(MouseEvent.CLICK, nextSceneB1);
button2.addEventListener(MouseEvent.CLICK, nextSceneB2);
function nextSceneB1(event)
{
MovieClip(root).gotoAndPlay(1,"scene2"); /
}
function nextSceneB2(event)
{
MovieClip(root).gotoAndPlay(1,"scene2"); /
}
场景 2:dont know what to add here
场景 3:Outcome based on Button1
场景 4:Outcome based on Button2
我该怎么办?
场景 1:
function nextSceneB1(e:Event):void
{
// Create a field that keeps where to go next.
MovieClip(root)['proceed'] = "scene3";
MovieClip(root).gotoAndPlay(1, "scene2");
}
function nextSceneB2(e:Event):void
{
// Create a field that keeps where to go next.
MovieClip(root)['proceed'] = "scene4";
MovieClip(root).gotoAndPlay(1, "scene2");
}
场景 2:
function nextScene2B(e:Event):void
{
// Use the kept field as an argument.
MovieClip(root).gotoAndPlay(1, MovieClip(root)['proceed']);
}
所以我做了4个场景。在第一个场景中有 2 个按钮,它们都用于下一个场景。在下一个场景中还有另一个按钮,但是根据您在第一个场景中单击的按钮,您会转到下一个场景。
让我们说得更清楚:
场景 1:Button1 和 Button2
场景 2:按钮
场景 3:基于 Button1 的结果
场景 4:基于 Button2 的结果
这是我得到的:
场景 1:
button1.addEventListener(MouseEvent.CLICK, nextSceneB1);
button2.addEventListener(MouseEvent.CLICK, nextSceneB2);
function nextSceneB1(event)
{
MovieClip(root).gotoAndPlay(1,"scene2"); /
}
function nextSceneB2(event)
{
MovieClip(root).gotoAndPlay(1,"scene2"); /
}
场景 2:dont know what to add here
场景 3:Outcome based on Button1
场景 4:Outcome based on Button2
我该怎么办?
场景 1:
function nextSceneB1(e:Event):void
{
// Create a field that keeps where to go next.
MovieClip(root)['proceed'] = "scene3";
MovieClip(root).gotoAndPlay(1, "scene2");
}
function nextSceneB2(e:Event):void
{
// Create a field that keeps where to go next.
MovieClip(root)['proceed'] = "scene4";
MovieClip(root).gotoAndPlay(1, "scene2");
}
场景 2:
function nextScene2B(e:Event):void
{
// Use the kept field as an argument.
MovieClip(root).gotoAndPlay(1, MovieClip(root)['proceed']);
}