# .visible property doesn't work

**URL:** <https://forum.kirupa.com/t/visible-property-doesnt-work/321663>\
**Category:** flash\
**Created:** [April 27, 2011, 3:43am UTC](https://forum.kirupa.com/t/visible-property-doesnt-work/321663 "2011-04-27T03:43:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![acrylics](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@acrylics](https://forum.kirupa.com/u/acrylics)\
**Post date:** [April 27, 2011, 3:43am UTC](https://forum.kirupa.com/t/visible-property-doesnt-work/321663/1 "2011-04-27T03:43:37Z")

</div>

```auto

        public function BrokenItem(originalImg:Bitmap,fixedImg:Bitmap) 
        {
            _originalImg = originalImg;
            _fixedImg = fixedImg;
            addChild(originalImg);
            originalImg.x = -originalImg.width / 2;
            originalImg.y = -originalImg.height / 2;
            addEventListener(MouseEvent.CLICK, _onClick);
            //add trays
            _tray= new Tray(5, 80);
            addChild(_tray);
            _tray.visible = false;
        }
        private function _onClick(e:MouseEvent):void {
            _tray.visible = true;
            removeEventListener(MouseEvent.CLICK, _onClick);
            addEventListener(MouseEvent.CLICK, _onTrayClick);
        }
        private function _onTrayClick(e:MouseEvent):void {
            addEventListener(MouseEvent.CLICK, _onClick);
            removeEventListener(MouseEvent.CLICK, _onTrayClick);
            _tray.visible = false;
        }
        private var _originalImg:Bitmap;
        private var _fixedImg:Bitmap;
        private var _tray:Tray;
        
    }

```

after first click the \_tray display object showed up.but when i clicked the \_tray object,what i meant to do was to make it unvisible.but seems the \_tray.visible doesn’t do the job which it should be.what’s the problem.the snippet tested well.please some help needed.
