Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Flex > Flex 2, 3 & 4

Reply
 
Thread Tools Rate Thread Display Modes
Old 06-26-2006, 08:55 PM   #1
stonyx
Registered User
 
stonyx's Avatar
 
Join Date: Jun 2006
Posts: 54
Default e4x and images

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
stonyx is offline   Reply With Quote
Old 06-30-2006, 06:18 PM   #2
stonyx
Registered User
 
stonyx's Avatar
 
Join Date: Jun 2006
Posts: 54
Default

any one
helloooooooooooooooo"

so nobody has work with e4x before?, or you just to busy to answer?

at least answer something like i don't know or stoo asking stupid questions
stonyx is offline   Reply With Quote
Old 06-30-2006, 06:20 PM   #3
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

I don't know... and I don't know why I am responding when I don't know the answer...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 07-01-2006, 04:21 PM   #4
nirth
Member
 
Join Date: May 2006
Posts: 46
Send a message via ICQ to nirth Send a message via AIM to nirth Send a message via MSN to nirth Send a message via Yahoo to nirth Send a message via Skype™ to nirth
Default

i could be wrong, but maybe it is becouse your server does not "understand" spaces in file names ie FOTOS/Abdo Arias, Williams Alejandro. jpg

Tell me does flex plays mp3 or you have similar problem?
__________________
OrangeBlog finally in english, but really bad one
nirth is offline   Reply With Quote
Old 07-03-2006, 04:00 PM   #5
stonyx
Registered User
 
stonyx's Avatar
 
Join Date: Jun 2006
Posts: 54
Default

Quote:
Originally Posted by nirth
i could be wrong, but maybe it is becouse your server does not "understand" spaces in file names ie FOTOS/Abdo Arias, Williams Alejandro. jpg

Tell me does flex plays mp3 or you have similar problem?

this project is for cd distribution so i don't think thats the problem
the mp3 files are ok
i know my problem is cause i'm a noob in ActionScript

is there any way i can trace
catalog.libro.imagen
when clicking on the datagrid and show
<imagen>FOTOS/Abdo Andrade, Alberto. jpg</imagen> in the mx:image

if i don't use e4x this is really easy i usually put
<mx:Image source="{datagrid.selectedItem.imagen}" />
and thats it
stonyx is offline   Reply With Quote
Old 07-03-2006, 04:14 PM   #6
nirth
Member
 
Join Date: May 2006
Posts: 46
Send a message via ICQ to nirth Send a message via AIM to nirth Send a message via MSN to nirth Send a message via Yahoo to nirth Send a message via Skype™ to nirth
Default

try this
Code:
<mx:Image source="{datagrid.selectedItem.imagen.text()}" />
__________________
OrangeBlog finally in english, but really bad one
nirth is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:26 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.