几年前,我开始使用actionscript 3,当时我刚从学校毕业,第一份真正的工作是,我不得不进入actionscript 2。所以,在把东西编码到actionscript 2大约三年之后,我已经忘记了actionscript 3。这真的让人头脑麻木,主要是因为所有的教程等等我一直在寻找使用类和公共函数等等。
这是一个基本的幻灯片,我们可以作为swf文件或exe运行。大部分代码是gotoAndStop或gotoAndPlay命令。由于as3的严格的类特性,切换和导航mebu让我有点抓狂。
当swf文件开始时,我有一个目标菜单。单击它可转到下一步或前进到其他步骤。这是导航菜单,如下代码所示。单击该菜单时,一个按钮(称为“菜单”)会生动地切换该菜单。一个prev_btn和next_btn位于菜单按钮的相邻边,它将允许它移动到下一个框架标签或预先的框架标签。
然后在任何时候,你都可以点击菜单按钮并打开主菜单。从这里你可以移动到时间轴的不同阶段。
所以我想不出如何通过保持相同的图形和易用性来做到这一点。
//fscommands that set up the exit and fullscreen functions
fscommand("fullscreen", "true");
fscommand("allowscale", "false");
fscommand("showmenu", false);
navmenu._visible=0;
menu_btn.onRelease=function()
{
navmenu._visible=1;
}
//******************Initialization When Program first starts*********************
_global.initialize=function(){
gotoAndStop("sc1-step0-0");
};
exit_btn.onRelease = function() {
fscommand("quit");
};
reset_btn.onRelease = function() {
initialize();
};
callouts_btn.onRelease = function(){
if (callouts_mc._visible == true) {
callouts_mc._visible = false;
}else{
callouts_mc._visible = true;
}
};
highlight_btn.onRelease=function(){
ToggleHighlights();
}
function ToggleHighlights(){
showHighlights = !showHighlights;
if(showHighlights){
highlights_mc.gotoAndPlay("show");
}
else{
highlights_mc.gotoAndPlay("hide");
}
}
function ShowHighlights(){
if( showHighlights ){
highlights_mc.gotoAndPlay("show");
}
else{
highlights_mc.gotoAndPlay("hide");
}
}
//*******Start Program**********
initialize();
prev_btn.onRelease=function(){
gotoAndPlay("sc1-step1-0");
}
next_btn.onRelease=function(){
gotoAndPlay("sc1-step3-0");
}发布于 2014-07-26 08:47:18
您在这里显示的代码被翻译成AS3,给出如下内容:
stage.displayState = StageDisplayState.FULL_SCREEN;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.showDefaultContextMenu = false;
var showHighlights:Boolean = false;
navmenu.visible = false;
menu_btn.addEventListener(MouseEvent.MOUSE_UP, menuVisible);
function menuVisible(e:MouseEvent):void {
navmenu.visible = true;
}
exit_btn.addEventListener(MouseEvent.MOUSE_UP, toQuit);
function toQuit(e:MouseEvent):void {
fscommand("quit");
}
reset_btn.addEventListener(MouseEvent.MOUSE_UP, init);
function init(e:MouseEvent):void {
initialize();
}
function initialize():void {
gotoAndStop("sc1-step0-0");
}
callouts_btn.addEventListener(MouseEvent.MOUSE_UP, callouts_mcVisible);
function callouts_mcVisible(e:MouseEvent):void {
callouts_mc.visible = !callouts_mc.visible;
}
highlight_btn.addEventListener(MouseEvent.MOUSE_UP, ToggleHighlights);
function ToggleHighlights(e:MouseEvent):void {
showHighlights = !showHighlights;
if (showHighlights)
{
highlights_mc.gotoAndPlay("show");
}
else
{
highlights_mc.gotoAndPlay("hide");
}
}
function ShowHighlights(e:MouseEvent) {
if (showHighlights)
{
highlights_mc.gotoAndPlay("show");
}
else
{
highlights_mc.gotoAndPlay("hide");
}
}
//*******Start Program**********
initialize();
prev_btn.addEventListener(MouseEvent.MOUSE_UP, gotoPrev);
function gotoPrev(e:MouseEvent):void {
gotoAndPlay("sc1-step1-0");
}
next_btn.addEventListener(MouseEvent.MOUSE_UP, gotoNext);
function gotoNext(e:MouseEvent):void {
gotoAndPlay("sc1-step3-0");
}https://stackoverflow.com/questions/24967422
复制相似问题