AS3如何隐藏除了点击的影片剪辑数组项?

时间:2014-11-15 14:43:29

标签: arrays actionscript-3 flash

我有一个按钮菜单,我想要隐藏所有按钮,除了点击的按钮,任何人都可以帮忙吗?

代码:

var _objects:Array = new Array();
var total:Number = sympols_mc.numChildren;
var i:uint;


for( i = 0; i < total; i++ )
{
    _objects.push(sympols_mc.getChildAt(i));

    _objects[i].btn_icon.addEventListener(MouseEvent.CLICK, btn_CLICK);
};

function btn_CLICK(e:MouseEvent):void
{
    for( i = 0; i < total; i++ )
    {
        //for example:
        _objects[i].btn_icon.visible = false; //I want to keep the visibility of the clicked button (e.target.parent.btn_icon) = true.
    };
};

感谢。

1 个答案:

答案 0 :(得分:0)

别忘了visible ...

function btn_CLICK(e:MouseEvent):void
{
    for( i = 0; i < total; i++ )
    {
        _objects[i].btn_icon.visible = false;
    }
    e.target.parent.btn_icon.visible = true;
}