简体   繁体   English

适用于所有场景/框架的AS3按钮(Flash CS6)

[英]AS3 Button that works for all Scene/Frame (Flash CS6)

Alright, I have a difficult problem "for me" , I'm a beginner in Adobe Flash CS6. 好吧,我有一个“对我而言”的难题,我是Adobe Flash CS6的初学者。

The Problem 问题

I can't make the button works for all frame. 我无法使按钮在所有画面上都有效。 I was unable to click once I jump to another frame or scene. 跳转到另一个帧或场景后,我无法单击。

The Explaination 讲解

I'll explain more detail what I'm trying to do with the button. 我将更详细地说明我要使用该按钮做什么。

  1. I Have have a button which is named "Back to Menu" that placed in "Play" Scene, the button supposed to get the user back to the menu. 我有一个名为“返回菜单”的按钮,该按钮位于“播放”场景中,该按钮应该可以使用户返回菜单。

    • "Main Menu" Scene (1 Frame) “主菜单”场景(1帧)
    • "Play" Scene (10 Frame) “播放”场景(10帧)
  2. The code is placed on frame 1, in the "Play" Scene and the code used is : 该代码位于“播放”场景中的第1帧上,使用的代码为:

 backtomenu.addEventListener(MouseEvent.CLICK, backmenuClick); function backmenuClick(ev:MouseEvent):void { gotoandPlay ("Main Menu"); } 

  1. So, at the Main Menu there is 9 button, each button from the "Main Menu" Scene will bring to the different frame at the "Play" Scene. 因此,在主菜单上有9个按钮,“主菜单”场景中的每个按钮将带到“播放”场景中的不同帧。 The backtomenu button works fine when I click the button that take me to the frame 1 in "Play Scene", but whenever I click the button that direct me from "Main Menu" Scene to frame 2 , 3 or 4 in "Play" Scene, the backtomenu button won't work. 当我单击将我带到“播放场景”中的帧1的按钮时,backtomenu按钮可以正常工作,但是每当我单击将我从“主菜单”场景定向到“播放”场景中的帧2、3或4的按钮时, ,返回菜单按钮将无法使用。

Is there any other way to make the code readable to all frame? 还有其他方法可以使代码对所有框架都可读吗? or make a universal button? 或制作一个通用按钮? Because I know the code wasn't read when I was at the 2nd Frame in the "Play" Scene. 因为我知道在“播放”场景中的第二帧时未读取代码。 do I have to make a different code for each frame? 我必须为每个帧制作不同的代码吗? if that so, that's insane. 如果那样的话,那太疯狂了。

You can put your "Back to Menu" button on a new layer with 1 keyframe & 9 frames to cover the whole "Play" scene. 您可以将“返回菜单”按钮放在具有1个关键帧和9个帧的新图层上,以覆盖整个“播放”场景。 Your "backtomenu.addEventListener" code needs to be placed in the keyframe of the new layer. 您的“ backtomenu.addEventListener”代码需要放置在新层的关键帧中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM