zoukankan      html  css  js  c++  java
  • FLEX 通过url 得到网页内容 xml通信

    <?xml version="1.0"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    				layout="absolute"
    				verticalAlign="middle"
    				backgroundColor="white"
    				initialize="init()">
    	<mx:LineChart id="lineChart"
    				  showDataTips="true"
    				  dataProvider="{dp}"
    				  width="438"
    				  height="327"
    				  seriesFilters="[]" x="10" y="149">
    		<!--showAllDataTips="true"-->
    		<mx:backgroundElements>
    			<mx:GridLines horizontalTickAligned="true" verticalTickAligned="true">
    				<mx:horizontalFill>
    					<mx:SolidColor color="haloBlue" alpha="0.2" />
    				</mx:horizontalFill>
    				<mx:horizontalAlternateFill>
    					<mx:SolidColor color="haloSilver" alpha="0.2" />
    				</mx:horizontalAlternateFill>
    				<mx:verticalFill>
    					<mx:SolidColor color="haloBlue" alpha="0.2" />
    				</mx:verticalFill>
    				<mx:verticalAlternateFill>
    					<mx:SolidColor color="haloSilver" alpha="0.2" />
    				</mx:verticalAlternateFill>
    			</mx:GridLines>
    		</mx:backgroundElements>
    		<!-- vertical axis -->
    		<mx:verticalAxis>
    			<mx:LinearAxis id="chartVerticalAxis" baseAtZero="false" title="Price" />
    		</mx:verticalAxis>
    		
    		<!-- horizontal axis -->
    		<mx:horizontalAxis>
    			<mx:CategoryAxis id="chartHorizontalAxis" categoryField="@date" title="Date" />
    		</mx:horizontalAxis>
    		
    		<!-- horizontal axis renderer -->
    		<mx:horizontalAxisRenderers>
    			<mx:AxisRenderer axis="{chartHorizontalAxis}" canDropLabels="true" />
    		</mx:horizontalAxisRenderers>
    		
    		<!-- series -->
    		<mx:series>
    			<mx:LineSeries id="lineseriesEx" yField="@open" form="segment" displayName="Open" itemRenderer = "testpackage.LineChartPointStyle" radius="1" chromeColor="#CD1785">
    				<mx:lineStroke>
    					<mx:Stroke color="#CD1785" weight="1.5" alpha="0.6"/>
    				</mx:lineStroke>
    			</mx:LineSeries>
    		</mx:series>
    	</mx:LineChart>
    	<mx:HTTPService id="httpServiceXMl" url="http://tools.localhost:8080//api" method="POST" showBusyCursor="true" resultFormat="e4x" result="onResult(event);" fault="onFault(event);">
    		<mx:request>
    			<method>public</method>
    			<type>xml</type>
    		</mx:request>
    	</mx:HTTPService>
    	<mx:Style>
    		.LineChartPointStyle{
    			
    		}
    	</mx:Style>
    	<mx:Script>
    		<![CDATA[
    			import mx.collections.ArrayCollection;
    			import mx.controls.Alert;
    			import mx.events.CloseEvent;
    			import mx.rpc.events.FaultEvent;
    			import mx.rpc.events.ResultEvent;
    
    			
    			private function init():void
    			{
    				//init dropdownlist
    				httpServiceXMl.url = "http://tools.localhost:8080/emailtrace/flexconphp/init/lsds";
    				httpServiceXMl.send();
    				//add event listener
    				testDB.addEventListener(MouseEvent.CLICK,testBindDB);
    				Ind.addEventListener(Event.CHANGE,Ind_changeHandler);
    /
    			}
    			private function onResult(event:ResultEvent):void 
    			{
    				var menus:XML = XML(event.result as String);
    				var results:XMLList = menus.children();
    				var array:Array = ElementToAttr(results);
    				trace(array);
    			}
    			private function onFault(event:FaultEvent):void 
    			{
    				var resultXML = event.fault.toString();
    				Alert.show(resultXML);
    			}
    			public function ElementToAttr(results:XMLList):Array
    			{
    				var array:Array=new Array();
    				for each(var child:XML in results){
    					var obj:Object=new Object();
    					
    					obj[child.nodeKind()]=child[child.nodeKind()];
    					for each(var ite:XML in child.children()){
    						obj[ite.name().toString()]=child[ite.name().toString()];
    					}
    					
    					/*
    					obj["name"]=child.name;
    					obj["grender"]=child.grender;
    					obj["from"]=child.from;
    					*/
    					
    					array.push(obj);                    
    				}
    				return array;
    			}
    			protected function Ind_changeHandler(event:Event):void
    			{
    				httpServiceXMl.send();    
    			}
    		]]>
    	</mx:Script>
    	<mx:XMLListCollection id="dp">
    		<mx:source>
    			<mx:XMLList>
    				<quote date="2/2010" open="0" />
    				<quote date="3/2010" open="0" />
    				<quote date="4/2010" open="0" />
    				<quote date="5/2010" open="0" />
    				<quote date="6/2010" open="0" />
    				<quote date="7/2010" open="0" />
    				<quote date="8/2010" open="188" />
    				<quote date="9/2010" open="2737" />
    				<quote date="10/2010" open="2595" />
    				<quote date="11/2010" open="4083" />
    				<quote date="12/2010" open="4386" />
    				<quote date="1/2011" open="697" />
    				<quote date="2/2011" open="0" />
    			</mx:XMLList>
    		</mx:source>
    	</mx:XMLListCollection>
    		<mx:Style>         global         {                 dropShadowEnabled:false;         }     </mx:Style> 
    		<mx:RadioButton x="337" y="42" groupName="showModel" label="Individual" id="Ind" selected="true"/>
    </mx:Application>
  • 相关阅读:
    easy ui 表单ajax和from两种提交数据方法
    easy ui 下拉级联效果 ,下拉框绑定数据select控件
    easy ui 下拉框绑定数据select控件
    easy ui 异步上传文件,跨域
    easy ui 菜单和按钮(Menu and Button)
    HTTP 错误 404.3
    EXTJS4.2 后台管理菜单栏
    HTML 背景图片自适应
    easy ui 表单元素input控件后面加说明(红色)
    EXTJS 4.2 添加滚动条
  • 原文地址:https://www.cnblogs.com/zcy_soft/p/1966774.html
Copyright © 2011-2022 走看看