PDA

View Full Version : how to load the xml i want?


stonyx
06-26-2006, 09:07 PM
i am really new in flex and AS so any idea will help

this is my mxml
<?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/));
//&& item.price >= priceSlider.values[0]
//&& item.price <= priceSlider.values[1];
}

]]>
</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"/>
<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>


i need to ad 3 buttons to this file and each button will load a different xml depending on what i want to search on

any idea?

firdosh
06-29-2006, 05:17 AM
are these files going to be local or loaded from a remote server ,cause if they are local you can just embed them using the Embed tag
[Embed source="my.xml" ]
private var myXML:Class

cheers
firdosh

stonyx
06-29-2006, 10:19 PM
this project is for a distribution cd
like i said i'm really new with Action Script
do you have any example or something?

stonyx
06-30-2006, 06:14 PM
this project is for a distribution cd
like i said i'm really new with Action Script
do you have any example or something?


now i know how, it was something so easy

hangalot
07-13-2006, 10:05 AM
are these files going to be local or loaded from a remote server ,cause if they are local you can just embed them using the Embed tag
[Embed source="my.xml" ]
private var myXML:Class

cheers
firdosh
that is compile time embedding, keep this in mind/