Flex Mobile Popup List Window


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <s:SkinnablePopUpContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
  3. xmlns:s="library://ns.adobe.com/flex/spark"
  4. backgroundColor="0x898989" width="400">
  5. <s:layout>
  6. <s:VerticalLayout gap="20" paddingBottom="10" paddingLeft="30"
  7. paddingRight="30" paddingTop="30" horizontalAlign="center"/>
  8. </s:layout>
  9. <fx:Script>
  10. <![CDATA[
  11. import mx.collections.ArrayCollection;
  12.  
  13. private var _dataProvider:ArrayCollection;
  14. private var _labelField:String;
  15. private var _allowMultipleSelection:Boolean;
  16. private var _selectedItems:Vector.<Object>;
  17.  
  18. [Bindable]
  19. public function get selectedItems():Vector.<Object> {
  20. return _selectedItems;
  21. }
  22.  
  23. public function set selectedItems(v:Vector.<Object>):void {
  24. _selectedItems = v;
  25. }
  26.  
  27. [Bindable]
  28. public function get allowMultipleSelection():Boolean {
  29. return _allowMultipleSelection;
  30. }
  31.  
  32. public function set allowMultipleSelection(v:Boolean):void {
  33. _allowMultipleSelection = v;
  34. }
  35.  
  36. [Bindable]
  37. public function get labelField():String {
  38. return _labelField;
  39. }
  40.  
  41. public function set labelField(v:String):void {
  42. _labelField = v;
  43. }
  44.  
  45. [Bindable]
  46. public function get dataProvider():ArrayCollection {
  47. return _dataProvider;
  48. }
  49.  
  50. public function set dataProvider(v:ArrayCollection):void {
  51. _dataProvider = v;
  52. }
  53.  
  54. private function onClick(commit:Boolean):void {
  55. super.close(commit, list.selectedItems);
  56. }
  57. ]]>
  58. </fx:Script>
  59.  
  60. <s:Label text="Select an item:" width="100%"/>
  61.  
  62. <s:List id="list" width="100%" height="100%"
  63. dataProvider="{dataProvider}"
  64. labelField="{labelField}"
  65. allowMultipleSelection="{allowMultipleSelection}"
  66. selectedItems="{selectedItems}"/>
  67.  
  68. <s:HGroup width="100%">
  69. <s:Button label="OK" width="50%" click="onClick(true)"/>
  70. <s:Button label="Cancel" width="50%" click="onClick(false)"/>
  71. </s:HGroup>
  72.  
  73. </s:SkinnablePopUpContainer>

URL: http://corlan.org/?p=3088

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.