flex入门小例子
发布时间:2020-12-15 04:50:53 所属栏目:百科 来源:网络整理
导读:?xml version="1.0" encoding="utf-8"?mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml"layout="absolute"width="500" height="300"creationComplete="init()"mx:Script![CDATA[import mx.managers.PopUpManager;import mx.collections.ArrayCollec
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="500" height="300" creationComplete="init()"> <mx:Script> <![CDATA[ import mx.managers.PopUpManager; import mx.collections.ArrayCollection; [Bindable] private var notes:ArrayCollection = new ArrayCollection(); private var addNoteScreen:AddNote; private function init():void { addNoteScreen = new AddNote(); addNoteScreen.addEventListener("SaveNote",saveNote); } private function addNote():void { PopUpManager.addPopUp(addNoteScreen,this,true); PopUpManager.centerPopUp(addNoteScreen); addNoteScreen.author.text = ""; addNoteScreen.topic.text = ""; addNoteScreen.description.text = ""; } private function saveNote(e:Event):void { var note:Note = new Note(); note.author = addNoteScreen.author.text; note.topic = addNoteScreen.topic.text; note.description = addNoteScreen.description.text; notes.addItem(note); PopUpManager.removePopUp(addNoteScreen); } ]]> </mx:Script> <mx:Panel title="Notes" width="100%" height="100%" layout="vertical" horizontalAlign="right" paddingTop="3" paddingLeft="3" paddingRight="3" paddingBottom="3"> <mx:DataGrid dataProvider="{notes}" width="100%" height="100%"> <mx:columns> <mx:DataGridColumn headerText="Author" dataField="author" width="80"/> <mx:DataGridColumn headerText="Topic" dataField="topic" width="100"/> <mx:DataGridColumn headerText="Description" dataField="description"/> </mx:columns> </mx:DataGrid> <mx:Button label="Add Note" click="addNote()"/> </mx:Panel> </mx:Application> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |