<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> <!--[CDATA[ import flash.events.MouseEvent; import mx.controls.Alert; [Bindable] [Embed(source="assets/folder_user.png")] public var officeIcon:Class; [Bindable] [Embed(source="assets/usersetting.png")] public var officeChildIcon:Class; [Bindable] [Embed(source="assets/platset.png")] public var manageChildIcon:Class; private function imgClick(event:MouseEvent):void { // Alert.show(event.currentTarget.source); popUpButton.close(); } ]]--> </mx:Script> <mx:Panel title="Tile Container Example" height="141" width="154" paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10"> //使用Grid也可以实现 <mx:Tile direction="horizontal" borderStyle="inset" horizontalGap="2" verticalGap="2" paddingTop="5" paddingBottom="5" paddingLeft="5" paddingRight="5"> <mx:Image autoLoad="true" source="{officeChildIcon}" height="32" width="32"/> <mx:Button icon="{manageChildIcon}" height="32" width="32"/> <mx:Button skin="{officeIcon}" height="32" width="32"/> <mx:Canvas/> <mx:Button label="5" height="32" width="32"/> <mx:Button label="6" height="32" width="32"/> </mx:Tile> </mx:Panel> <mx:Canvas id="canvas" width="156" height="132"> <mx:PopUpButton id="popUpButton" openAlways="true" toolTip="请选择表情图片" width="50" top="10" left="10" arrowButtonWidth="0" icon="@Embed('assets/platset.png')"> <mx:popUp> <mx:TitleWindow id="titleWindow_popUp" status="单击选择聊天表情" width="250" height="200" showCloseButton="true" verticalScrollPolicy="off" horizontalScrollPolicy="off" close="popUpButton.close()"> <mx:ToolBar width="430"> <mx:Repeater id="myRep" dataProvider="{arrColl}"> <mx:Image click="imgClick(event)" buttonMode="true" data="{myRep.currentIndex}" toolTip="{myRep.currentItem.tp}" source="{myRep.currentItem.icon}"/> </mx:Repeater> </mx:ToolBar> </mx:TitleWindow> </mx:popUp> </mx:PopUpButton> </mx:Canvas> <mx:ArrayCollection id="arrColl"> <mx:source> <mx:Array id="arr"> <mx:Object data="0" tp="微笑" label="" icon="assets/folder_user.png"/> <mx:Object data="1" tp="撇嘴" label="" icon="assets/usersetting.png"/> <mx:Object data="2" tp="色" label="" icon="assets/platset.png"/> <mx:Object data="3" tp="发呆" label="" icon="assets/folder_user.png"/> </mx:Array> </mx:source> </mx:ArrayCollection> </mx:Application>