Actionscript how to get name of instance using getChildByName
问题 Okay so I have a MovieClip called sC and need to write a code where, if you click the button (sC) then sC will dissapear. The function needs to work for multiple buttons. What I tried was sC.addEventListener(MouseEvent.CLICK, clickHandler); function clickHandler(event:MouseEvent):void { var self; self = MovieClip(getChildByName(event.target.name)); self.visible=false; Now when I try this code, it gives me an error when I click sC. It says "cannot access a property or method of a null object