1.chartdata.xml 2.MyColumnChart.mxml模块 Array; public function setData(dataList:Array):void { this.dataList = dataList; } ]]> 3.主程序ChartModula.mxml文件 Array; private var mloader:ModuleLoader; private var showtype:String; private function init():void { var loader:URLLoader = new URLLoader(); var request:URLRequest = new URLRequest(); request.url = "chartdata.xml"; loader.addEventListener(Event.COMPLETE,chartdataXm lOnLoaded); loader.load(request); } private function chartdataXmlOnLoaded(event:Event):void { arrData = new Array(); var xml:XML = new XML(event.currentTarget.data); for each(var brand:XML in new XMLList(xml.brand)) { arrData.push( {name:brand.@name, value:brand.@value}); } grd.dataProvider = arrData; } private function showChart(type:String):void { showtype = type; if(mloader!=null) this.removeChild(mloader); mloader = new ModuleLoader(); mloader.url = "modulas/MyColumnChart.swf"; mloader.addEventListener(ModuleEvent.READY,onReady ); mloader.loadModule(); } private function onReady(event:ModuleEvent):void { //添加MyColumnChart模块 this.addChild(mloader); (mloader.child as MyColumnChart).setData(arrData); } ]]-->
[ActionScript3.0][My flex]读书笔记四之 图标模块应用实例
最新推荐文章于 2019-08-10 00:07:25 发布