Professional Web Applications Themes

combo box data binding - Macromedia Flex General Discussion

<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns="*" creationComplete="send_data()"> <mx:HTTPService id="userRequest" url="http://suse/websites/team/Mahendra/createseries.php" useProxy="false" result="results(event);"/> <mx:Script> <![CDATA[ import mx.controls.Alert; import mx.collections.ArrayCollection; import mx.rpc.events.ResultEvent; [Bindable] public var arr:ArrayCollection; [Bindable] public var aray:Array; private function results(event:ResultEvent):void { arr = event.result.Mylog; //aray= arr.toArray(); //Alert.show(arr.length.toString()); Alert.show(arr.toString()); } private function send_data():void { userRequest.send(); } ]]> </mx:Script> <mx:ComboBox id="hello" dataProvider="{arr}" x="86" y="253" width="133" > </mx:ComboBox> </mx:Application> my php script returning me <?xml version="1.0" encoding="utf-8"?> <Mylog> <series>Convertible</series> </Mylog><Mylog> <series>Sedans</series> </Mylog><Mylog> <series>Sport</series> </Mylog> this is my code . I want to fill combobox with the all values of series please help me . Means bind the combo box with httpservice ...

  1. #1

    Default combo box data binding

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
    xmlns="*" creationComplete="send_data()">

    <mx:HTTPService id="userRequest"
    url="http://suse/websites/team/Mahendra/createseries.php"
    useProxy="false" result="results(event);"/>

    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    import mx.collections.ArrayCollection;
    import mx.rpc.events.ResultEvent;
    [Bindable]
    public var arr:ArrayCollection;
    [Bindable]
    public var aray:Array;

    private function results(event:ResultEvent):void
    {
    arr = event.result.Mylog;
    //aray= arr.toArray();
    //Alert.show(arr.length.toString());
    Alert.show(arr.toString());

    }
    private function send_data():void {
    userRequest.send();
    }
    ]]>
    </mx:Script>



    <mx:ComboBox id="hello" dataProvider="{arr}" x="86" y="253"
    width="133" >
    </mx:ComboBox>


    </mx:Application>

    my php script returning me
    <?xml version="1.0" encoding="utf-8"?>
    <Mylog>

    <series>Convertible</series>
    </Mylog><Mylog>

    <series>Sedans</series>
    </Mylog><Mylog>

    <series>Sport</series>
    </Mylog>


    this is my code . I want to fill combobox with the all values of series
    please help me . Means bind the combo box with httpservice result

    007none Guest

  2. #2

    Default Re: combo box data binding

    Hi,
    set the labelField of the ComboBox to "series" as show in the code below.

    Hope this helps.

    <mx:ComboBox id="hello" dataProvider="{arr}" labelField="series" x="86"
    y="253" width="133" >
    </mx:ComboBox>


    SujitG Guest

  3. #3

    Default Re: combo box data binding

    I have changed my php code it will return me this xml

    <?xml version="1.0" encoding="utf-8"?>
    <Mylog>

    <product productId="1">
    <series>Convertible</series>
    </product>

    <product productId="2">
    <series>Sedans</series>
    </product>

    <product productId="3">
    <series>Sport</series>
    </product>

    </Mylog>


    then i have changed 2 place
    arr = event.result.Mylog.product;

    and yeah label field in combo

    Thanks


    007none Guest

  4. #4

    Smile Re: combo box data binding

    how to bind the combo box value from webservice , to input for another webservice
    abcd Guest

Similar Threads

  1. How to display a set of data in a data grid when drivenby a combo box?
    By Si Fi in forum Macromedia Flash Data Integration
    Replies: 5
    Last Post: August 16th, 05:03 PM
  2. Data Binding
    By GeorgeWS in forum Macromedia Flash Data Integration
    Replies: 2
    Last Post: August 5th, 06:37 PM
  3. Replies: 0
    Last Post: June 1st, 04:01 PM
  4. Where's my mx.data.binding?
    By danthewireman in forum Macromedia Flash Actionscript
    Replies: 0
    Last Post: February 27th, 11:21 PM
  5. combo box and data
    By macamarr in forum Microsoft Access
    Replies: 0
    Last Post: July 12th, 06:32 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139