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

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -