Hi,

I'm trying to display the categoryid of an item in a XMLListCollection
in a label for the application below and I get the following warning
message while debugging :

warning: unable to bind to property 'categoryid' on class 'XML' (class
is not an IEventDispatcher)
warning: unable to bind to property 'categoryid' on class 'XML' (class
is not an IEventDispatcher)
warning: unable to bind to property 'categoryid' on class 'XML' (class
is not an IEventDispatcher)
warning: unable to bind to property 'categoryid' on class 'XML' (class
is not an IEventDispatcher)
warning: unable to bind to property 'categoryid' on class 'XML' (class
is not an IEventDispatcher)
warning: unable to bind to property 'categoryid' on class 'XML' (class
is not an IEventDispatcher)

The application :

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="vertical" creationComplete="hsGetCategories.send()">
<mx:Script>
    <![CDATA[
        import mx.utils.XMLUtil;
        import mx.collections.XMLListCollection;
        import mx.rpc.events.FaultEvent;
        import mx.rpc.events.ResultEvent;
       
        private var xmlListCategories:XMLListCollection;
        private var xmlListCallTypes:XMLListCollection;

        //Resulthandler and fault handler for get categories
       
        private function hsGetCatRH(evt:ResultEvent):void    {
            xmlListCategories = new
XMLListCollection(evt.result.category);
            trace(xmlListCategories);
            cmbCategories.dataProvider = xmlListCategories;
            cmbCategories.labelField = "categoryname";
        }
       
        private function hsGetCatFH(evt:FaultEvent):void    {
            trace("inside getcat error" + evt.message);
        }
    ]]>
</mx:Script>

<mx:HTTPService id="hsGetCategories"
url="http://127.0.0.1/flex/php/getCategories.php"; resultFormat="e4x"
method="POST" useProxy="false" result="hsGetCatRH(event)"
fault="hsGetCatFH(event)">
</mx:HTTPService>

<mx:ComboBox id="cmbCategories" />
<mx:Label text="{cmbCategories.selectedItem.categoryid}" />

</mx:Application>

GetCategories.php generates the following XML output :

<category>
  <categoryid>1</categoryid>
  <categoryname>Category 1</categoryname>
</category>
<category>
  <categoryid>2</categoryid>
  <categoryname>Category 2</categoryname>
</category>
<category>
  <categoryid>90</categoryid>
  <categoryname>Category 3</categoryname>
</category>

The Label displays the selected ID correctly however throws the
warning mentioned above.  Is this OK or should I change something..
Any help will be appreciated.

Thanks and regards,
Abhishek

Reply via email to