Comunidad de diseño web y desarrollo en internet online

Flex: agregar componente dependiendo de condicional

Citar            
MensajeEscrito el 31 Mar 2009 11:19 pm
En mi mxml tengo este tag:

Código :

<mx:Image source="{getImage()}" width="16" height="16" />


pero si getImage() devuelve "null" me gustaria eliminar dicho tag...

alguna idea? es que a mi no se me ocurre nada :oops:

Por Acreonte

Claber

1543 de clabLevel

5 tutoriales
6 articulos

Genero:Masculino  

Digital Scientist

firefox
Citar            
MensajeEscrito el 01 Abr 2009 11:08 am
Si haces un binding sobre el source solo puedes manipular este, no el contenedor. Si en vez de hacer que el source sea el valor que devuelve una función, lo atas a una variable bindable, podrías intentar hacer algo así:

<mx:Image source="{image}" width="16" height="16" visible={image!=null} />

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 01 Abr 2009 08:22 pm
Hola

Complentado lo q decia solisarg, yo le agregaria la propiedad includeInDisplay

Código ActionScript :

<mx:Image source="{image}" width="16" height="16" visible="{image!=null}" includeInLayout="{image!=null}" />


Asi si esta no visible tampoco se renderee y deje un espacio vacio


Saludos!

Por alfathenus

833 de clabLevel

5 tutoriales

 

buenos aires || Argentina

firefox
Citar            
MensajeEscrito el 02 Abr 2009 11:25 am
perfecto!
muchas gracias a ambos

Ernesto

Por Acreonte

Claber

1543 de clabLevel

5 tutoriales
6 articulos

Genero:Masculino  

Digital Scientist

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.