Andrés Villagrán Placencia Flex / AS3 / Papervision3D / PHP / Rails Developer


Acceder a componente padre desde itemRenderer

Una forma útil de acceder a algún componente padre desde un itemRenderer personalizado es a través de la propiedad owner, como ejemplo práctico tendremos un List y un componente del tipo VBox con un botón que llamará a una función de la lista:


  2. <?xml version="1.0" encoding="utf-8"?>
  3. <mx:List xmlns:mx=""
  4. itemRenderer="itemRender">
  5. <mx:Script>
  6. <![CDATA[
  7. public function getClick(datos:String):void {
  8. trace("Datos: " + datos);
  9. }
  10. ]]>
  11. </mx:Script>
  12. </mx:List>


  2. <mx:VBox xmlns:mx="">
  3. <mx:Script>
  4. <![CDATA[
  5. public function enviarDatos():void {
  6. var padre:Lista = owner as Lista;
  7. padre.getClick("Enviando datos");
  8. }
  9. ]]>
  10. </mx:Script>
  11. <mx:Button label="Boton" click="enviarDatos()" />
  12. </mx:VBox>

Espero que les sirva de ayuda!

Comments (2) Trackbacks (0)
  1. Has Read several times, but don’t care nothing have not understood.

  2. Do you mind if I quote a few of your articles as long as I provide credit and sources back to your blog? My blog is in the very same area of interest as yours and my users would certainly benefit from some of the information you present here. Please let me know if this alright with you. Thanks a lot!

Leave a comment

No trackbacks yet.