闪光的SimpleButton坚持在全球的状态?闪光、状态、在全球、SimpleButton

2023-09-08 13:42:54 作者:终生守

我正在使用ActionScript 3 Flash项目。

I'm working on a Flash project using ActionScript 3.

通过添加和删除主舞台的直接孩子不同的模式之间我们的界面切换 - 我们称这些场景

Our interface switches between different modes by adding and removing the direct children of the main stage--we call these scenes.

我遇到的问题是这样的:其中一个场景中有一个的SimpleButton(flash.display.SimpleButton)具有鲜明起来了状态。当我将鼠标放置一个按钮,就进入过状态的预期。但如果应用程序自动切换到一个新的场景(在这种情况下,一个视频结束和对应用程序的动作),然后用户返回(导致被重新加入原场景)时,按钮将保持过的状态,直到我的鼠标回来,然后出去了。我希望能够迫使该按钮返回到弹起状态。

The problem I've encountered is this: One of these scenes has a SimpleButton (flash.display.SimpleButton) with distinct up and over states. When I mouseover a button, it goes to the over state as expected. But if the application automatically switches to a new scene (in this case, a video finishes and the app moves on) and then the user navigates back (causing the original scene to be re-added), the button stays in the over state until I mouse back in and then out again. I'd like to be able to force that button back into its up state.

我试过设置b.overState = b.upState,但随后有后续翻车无外观变化。我也试着分派ROLL_OUT事件到按钮对象,但这并不无论做任何事情。

I've tried setting b.overState = b.upState, but then there's no appearance change on subsequent rollovers. I've also tried dispatching a ROLL_OUT event to the button object, but that doesn't do anything either.

比实现从无到有的东西,公开的方式来强制状态改变其他任何想法?

Any ideas other than implementing something from scratch that exposes a way to force a state change?

推荐答案

我有同样的问题,一些菜单,每个菜单从新加入前的显示列表中删除。

I had the same problem with some menus, each menu was removed from the display list before the new one was added.

在多次试图找到一个变通的最好的一个,我发现是要保持他们的显示列表中,只是设置自己的知名度为false。

After many attempts to find a work around the best one I found was to keep it them on the display list and just set their visibility to false.

function setMenu(newMenu:Sprite = null):void
{
    menuA.visible = menuB.visible = menuC.visible = false;
    if(newMenu)
    {
        newMenu.visible = true;
    }
}
 
精彩推荐