Flex 3: How do I remove a Component Using a Button in the Component -
i'd use button within component remove it. so, click , component gone. but, haven't figured out how reference component within component. should put in click=""?
my component: popcanvas
<mx:canvas xmlns:mx="http://www.adobe.com/2006/mxml">     <mx:panel width="200" height="200"  title="hello"            click="remove=">      </mx:panel> </mx:canvas>   in main app:
var popcanvas:popcanvas= new popcanvas;         popcanvas.x = 20;         popcanvas.y = 30;         this.addchild(popcanvas);   any suggestions?
thank you.
-laxmidi
okay,
this came with:
<?xml version="1.0" encoding="utf-8"?> <mx:canvas xmlns:mx="http://www.adobe.com/2006/mxml">  <mx:script>     <![cdata[         public function removeme(event:mouseevent):void  {             this.removechild(event.currenttarget displayobject);         }     ]]> </mx:script>      <mx:panel width="400" height="300"  title="hello"  click="removeme(event)">      </mx:panel> </mx:canvas>   so, used event's currenttarget reference component in order remove it. if clicks anywhere on component it's removed.
thanks.
-laxmidi
Comments
Post a Comment