flexÖÐxmlת»¯ÎªarrayʵÀý
±¾ÎĹ²Á½¸öÎļþ£ºtranslate.mxml ºÍ mapmarking.xml
1¡¢translate.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
minWidth="1024" minHeight="768">
<fx:Script>
<![CDATA[
//xml translate array
public function xmlToArr(xmlObj:XML):Array{
var toArr:Array = new Array();
for(var i:uint = 0; i < xmlObj.site.length(); i++){
toArr.push({pid: xmlObj.site[i].id,
province: xmlObj.site[i].province,
city: xmlObj.site[i].city,
updName: xmlObj.site[i].station,
latitude: xmlObj.site[i].ypos[0],
longitude: xmlObj.site[i].xpos,
telephone: "110"
});
}
return toArr;
}
//parse the array
private function arrParse():void{
var arr:Array = xmlToArr(xmlID);
for(var i:int = 0; i < arr.length; i++){
trace(arr[i].updName + "========" + arr[i].longitude);
}
}
]]>
</fx:Script>
<mx:Button id="butID" horizontalCenter="0" fontSize="18"
label="xml translate array" click="arrParse();"/>
<fx:Declaration
Ïà¹ØÎĵµ£º
Ëæ×Å Adobe Flex ¼¼ÊõµÄ³ÉÊ죬ԽÀ´Ô½¶àµÄÆóÒµ¿ªÊ¼²ÉÓà Adobe Flex ¼¼Êõ¿ª·¢ RIA (Rich Internet Application)¡£ÔÚ³£¼ûµÄ RIA Ó¦ÓóÌÐò¼Ü¹¹ÖУ¬¿Í»§¶ËÓà Adobe Flex äÖȾ³öƯÁÁµÄ½çÃ棬¶øäÖȾ½çÃæËùÐèÒªµÄÊý¾ÝÔò´Ó·þÎñÆ÷¶ËµÄÓ¦ÓóÌÐò»ñÈ¡¡£ÔÚ Java EE ÁìÓò£¬·þÎñÆ÷¶ËµÄÓ¦ÓóÌÐòͨ³£ÊÇÔ ......
Ò»¡¢Ê¹Óñ¾µØÑùʽ¶¨Òå
ʹÓÃ<mx:Style>±êÇ©ÔÚMXMLÎļþÖд´½¨±¾µØµÄÑùʽ¶¨Òå¡£Õâ¸ö±êÇ©°üº¬ÁË·ûºÏCSS2.0Óï·¨µÄÑùʽ±í¶¨
Òå¡£ÕâЩ¶¨Òå»áÓ¦Óõ½µ±Ç°ÎĵµÒÔ¼°µ±Ç°ÎĵµµÄ×ÓÎĵµ¡£
<mx:style>
.solidBorder{//ÀàÑ¡ÔñÑùʽ
border-style:solid;
}
button{//×é¼þ¶¨ÒåÑùʽ
border-style:solid;
}
....
</mx: ......
protected void btn_write_Click(object sender, EventArgs e)
{
XmlWriterSettings settings=new XmlWriterSettings();
settings.Indent=true;
setting ......
Flex ºÍC++ Ö®¼ä´«Êä½á¹¹ÌåÊý¾Ý
Ò»Ö±ÏëÊÔÑéÓýṹÌå´«Êý¾Ý
µ«ÊÇFlex ºÍC++ µÄÀàÐÍËùÕ¼µÄ×Ö½ÚÊýÓÐʱ²»Ò»Ñù
Èçint ÔÚC++ÖÐÕ¾2¸ö×Ö½Ú£¬¶øÔÚFlexÖÐÕ¼4¸ö×Ö½Ú¡£
ת»»±È½ÏÂé·³¡£
×îºó¾ö¶¨ÓÃXML½øÐд«Êä
È»ºóÁ½±ß¶¼¼ÓÒ»¸öXML ½âÎöºÍ·â×°Àà¡£
C++ ¶ËʹÓõÄtinyXML Àà
FlexÖ±½ÓʹÓÃ×Ô¼º´øµÄ E4X Àà
Flex´úÂëÈçÏÂ
&nb ......
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
width="550" height="400">
<mx:Script>
<![CDATA[
&n ......