我有一个脚本,一旦点击(按钮)一些其他东西隐藏然后再次点击它重新显示.问题是一旦隐藏它永远不再显示这里是脚本:
menu_start.addEventListener(MouseEvent.CLICK,myClickFunction); function myClickFunction(event:MouseEvent) { // Hide the first and show the next here if (menu_menu.visible == true){ menu_menu.visible = false; } if (menu_menu.visible == false) { menu_menu.visible == true; } }
非常感谢.
解决方法
The reason is when you click on the
button,it does hide but again when
you click on the same button it does
not show back
如果我在上述陈述中错了,请纠正我.
现在尝试一下我说的话,有两个按钮隐藏和显示.创建两个新函数并尝试一下,如果这样有效,那么你的逻辑中就会缺少一些东西,如果这不起作用那么请告诉我们.
也试试这个.
function myClickFunction(event:MouseEvent) { // Hide the first and show the next here if (menu_menu.visible){ menu_menu.visible = false; } else { menu_menu.visible = true; } }
另一个问题可能是,当你点击按钮可能是它没有再次获取menu_menu属性作为其隐藏或销毁.它是在同一个组件内还是从其他地方调用?