hi everyone
my question i think is simple but i'm really new in flex and ActionScript
i have this mxml
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="*"
creationComplete="srv.send()" viewSourceURL="srcview/index.html">
<mx:Style source="main.css"/>
<mx:Script>
<![CDATA[
import mx.styles.StyleManager;
private function filterProduct(item:Object):Boolean
{
return item.name.match(new RegExp("^" + inputText.text, "i\*" + /abc|xyz/));
}
]]>
</mx:Script>
<mx:HTTPService id="srv" url="datos/datos2.xml"
resultFormat="e4x" />
<mx:XMLListCollection id="xlc"
source="{srv.result.*}"
filterFunction="filterProduct"/>
<mx:Panel width="568" height="569" layout="absolute" backgroundColor="#800000">
<mx:DataGrid dataProvider="{xlc}" height="485"
editable="false" width="150" id="datagrid" scroll="true" change="xlc.refresh()">
<mx:layoutConstraints>
<mx:Anchor top="5" left="5"/>
</mx:layoutConstraints>
<mx:columns>
<mx:Array>
<mx:DataGridColumn columnName="name"/>
</mx:Array>
</mx:columns>
</mx:DataGrid>
<mx:TextArea width="353" height="291" textAlign="justify" htmlText="{datagrid.selectedItem.desc}"
wordWrap="true" styleName="main.css">
<mx:layoutConstraints>
<mx:Anchor right="25" top="5"/>
</mx:layoutConstraints>
</mx:TextArea>
<mx:Image x="374" y="304" width="164" height="181" source="{datagrid.selectedItem.imagen}"/>
<mx:ControlBar>
<mx:layoutConstraints>
<mx:Anchor bottom="0"/>
</mx:layoutConstraints>
<mx:TextInput id="inputText" width="154"
change="xlc.refresh()" text="Buscar" backgroundColor="#f0eff1"/>
</mx:ControlBar>
</mx:Panel>
</mx:Application>
this is part of the xml file
Code:
<?xml version="1.0"?>
<catalog>
<libro>
<name>A orillas de una laguna.</name>
<desc><![CDATA[Libro de Edmundo Batres Ledón, Roque ]]> Ballinas Ballinas, Francisco Fonz Chan,</desc>
<imagen>A orillas de una laguna.jpg</imagen>
<audio>AUDIO/1.mp3</audio>
<video>VIDEOS/lema.flv</video>
<otros>OTROS/Discurso por el instituto.pdf</otros>
</libro>
<libro>
<name>Abdo Andrade, Alberto. </name>
<desc><![CDATA[Médico cirujano. Nació el 13 de mayo de 1957, originario de Tabasco. ]]></desc>
<imagen>FOTOS/Abdo Andrade, Alberto. jpg</imagen>
<audio>AUDIO/2.mp3</audio>
</libro>
<libro>
<name>Abdo Arias, Williams Alejandro. </name>
<desc><![CDATA[Maestro en Derecho Constitucional y Amparo. ]]></desc>
<imagen>FOTOS/Abdo Arias, Williams Alejandro. jpg</imagen>
<audio>AUDIO/3.mp3</audio>
</libro>
<libro>
<name>Abdo Francis, Jorge.</name>
<desc><![CDATA[10 de abril de 1958. Licenciado y doctorado en Derecho por la UNAM. Ha sido profesor en la ]]></desc>
<imagen>FOTOS/Abdó, Jorge.jpg</imagen>
</libro>
<libro>
<name>Abogado General. </name>
<desc><![CDATA[Área que depende directamente de la Rectoría de la <B>UJAT</B>; tiene como objetivo representar ]]></desc>
<imagen>Abogado General. </imagen>
</libro>
what i want to do is to show the image when i click on any name on the datagrid
when i run the file it gives me an error but if i erase the code of the mx:image it runs perfect
thanks