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.