Flex +WebService

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Script>
        <![CDATA[
            import mx.controls.DataGrid;
            import flash.external.ExternalInterface;
            import flash.geom.Point;
            import flash.net.navigateToURL;
            import mx.messaging.AbstractConsumer;
            import mx.controls.Alert;
            import mx.events.CalendarLayoutChangeEvent;
            import mx.collections.ArrayCollection;
            import mx.controls.ComboBox;
            import mx.charts.series.AreaSeries;
            import mx.charts.series.items.AreaSeriesItem;
            import mx.charts.HitData;
            import mx.charts.CategoryAxis;
            import mx.charts.chartClasses.Series;
            import mx.charts.AreaChart;
            import mx.charts.series.AreaSeries;
            import mx.styles.StyleManager;
            import mx.charts.HitData;
            import mx.charts.series.items.LineSeriesItem;
            import mx.containers.ViewStack;
            import mx.rpc.events.FaultEvent;
            import mx.rpc.events.ResultEvent;
            import mx.utils.StringUtil;
    import mx.collections.ArrayCollection;
   [Bindable]
   private var nums:ArrayCollection=new ArrayCollection();
   private var numArr:ArrayCollection = new ArrayCollection();
   private var db:ArrayCollection = new ArrayCollection ([
    {INFORTYPENAME:"异常信息",NUM:21,T:4},
    {INFORTYPENAME:"普通信息",NUM:26,T:3},
    {INFORTYPENAME:"重大异常信息",NUM:6,T:5}
   ]);
   //页面初始化
   private function init():void{
       dataService.GetStatisticsInfo();
   }
   //鼠标放在每一个部分时候的展示信息
   private function showMoreInfo(data:Object, field:String, index:Number, percentValue:Number):String{
   var percent:String = percentValue.toString().substr(0,6);
    return data.INFORTYPENAME + "\n 总数:" + data.NUM + "\n 百分比:" + percent + "%";
   }
    //处错误的时候提示信息
    public function onFault(event:FaultEvent):void{
    Alert.show("调用超时!");
    }
    //生成数据数组
    public function onGetStatisticsInfo(event:ResultEvent):void{
        //dgMQ.dataProvider=evt.result.Tables.ds.Rows;  numArr
        //numArr=event.result.Tables.ds.Rows;
        nums=event.result.Tables.ds.Rows;
        //Alert.show(nums[0]["INFORTYPENAME"].toString());
        //var m:int=0;
        //Alert.show(nums.length.toString());
        //for(m;m<nums.length;m++)
        //{  
        //  Alert.show(m.toString()+"dfd");
        //  Alert.show(nums[m][2].toString());
         //   numArr.addItem({NUM:nums[m][0],INFORTYPENAME:nums[m][2]});
       // }
 
        //var dt:DataGrid=dataProvider=event.result.Tables.ds.Rows;
     // nums = event.result.
       
    }
        ]]>
    </mx:Script>
     
<mx:Model id="model" source="crossdomain.xml"/>
<mx:WebService id="dataService"
         wsdl="{model.webservice}"
         showBusyCursor="true" useProxy="false">
         <mx:operation name="GetStatisticsInfo" result="onGetStatisticsInfo(event)" fault="onFault(event)" />
</mx:WebService> 
<mx:PieChart id="pie" dataProvider="{nums}" width="50%" height="50%" showDataTips="true" creationComplete="init()">
  <mx:series>
   <mx:PieSeries field="NUM" labelPosition="callout" nameField="INFORTYPENAME" labelFunction="showMoreInfo">
    <!-- 清除掉投影-->
    <mx:filters><mx:Array/></mx:filters>
     
    <!-- 内部分割线条 -->
    <mx:radialStroke>
     <mx:Stroke weight="1" color="#ffffff" alpha="0.3" />
    </mx:radialStroke>
     
    <!-- 圆周边 边线 -->
    <mx:stroke>
     <mx:Stroke weight="2" color="#000000" alpha="0.5" />
    </mx:stroke>
     
    <!-- 提示信息的线 -->
    <mx:calloutStroke>
     <mx:Stroke weight="1" color="#000000" alpha="0.5" />
    </mx:calloutStroke>
   </mx:PieSeries>
  </mx:series>
   
 </mx:PieChart>
 <!-- 图例说明 -->
 <mx:Legend dataProvider="{pie}" />
</mx:Application><br><br><br>、、、、、、、、、、、、、、、、、、、、、、、、、<br>配置文件

<config>
<webservice>http://130.120.110.3:1122/WSForFlex.asmx?wsdl</webservice>
<main>http://www.baidu.com</main>
</config>

  

Flex +WebService,布布扣,bubuko.com

Flex +WebService

上一篇:兼容IE与Firefox的js 复制代码


下一篇:jquery mobile界面数据刷新