Flex单击图表弹出控件

<?xml version="1.0" encoding="utf-8"?>
<mstr:MstrApplication xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:mstr="http://web.microstrategy.com/visframe" xmlDataFile="MSTR2.xml" layout="absolute">
<fx:Script>
<![CDATA[
import mx.charts.events.ChartItemEvent;
import mx.containers.TitleWindow;
import mx.controls.Alert;
import mx.controls.Label;
import mx.events.CloseEvent;
import mx.events.ItemClickEvent;
import mx.managers.PopUpManager;
private var mstrcolumn:MstrColumnChart;
private var titleWindow:TitleWindow; //定义一个TitleWindow布局控件类似panel
private function init():void { //传递控件id过来等下弹出
titleWindow = new TitleWindow(); //实例化一个控件
titleWindow.title="标题";
titleWindow.showCloseButton = true;
titleWindow.addEventListener(CloseEvent.CLOSE, titleWindow_close);
titleWindow.addChild(cc);

PopUpManager.addPopUp(titleWindow, this, true);
PopUpManager.centerPopUp(titleWindow);
}
private function createchar():void{

mstrcolumn=new MstrColumnChart();
mstrcolumn.modelKey="model1";
mstrcolumn.id="cc";
mstrcolumn.width=240;
mstrcolumn.height=180;
mstrcolumn.addEventListener(ItemClickEvent.ITEM_CLICK,cc_itemClickHandler);
this.addChild(mstrcolumn);
}
private function titleWindow_close(evt:CloseEvent):void {
PopUpManager.removePopUp(titleWindow);
createchar();
}
private function aaa(evt:ItemClickEvent):void {
Alert.show("ddd");
}

protected function cc_itemClickHandler(event:ChartItemEvent):void
{
init();
}

]]>
</fx:Script>
<fx:Declarations>
<mstr:Model id="model1" baseModelKey="wsjg" templateDefn="r.[r:(1):(1);c:(1):(2)]"/>
</fx:Declarations>
<mstr:MstrColumnChart modelKey="model1" id="cc" width="240" height="180" itemClick="init()"/>

<mstr:MstrButton label="Launch TitleWindow" click="init()" x="329" y="70"/>
<mstr:MstrDataGrid x="116" y="263" id="cn" modelKey="model1"/>
</mstr:MstrApplication>

你可能感兴趣的:(Flex)