Warnings in binding attributes.

768
1
Jump to solution
04-09-2012 11:15 PM
sherlytobias
New Contributor
My application is working properly but I'm having this error.. can I just ignore this warnings?
warning: unable to bind to property 'region' on class 'Object' (class is not an IEventDispatcher) warning: unable to bind to property 'summary' on class 'Object' (class is not an IEventDispatcher) warning: unable to bind to property 'name' on class 'Object' (class is not an IEventDispatcher)


Here is my code..

<?xml version="1.0" encoding="utf-8"?> <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"    xmlns:s="library://ns.adobe.com/flex/spark"   xmlns:esri="http://www.esri.com/2008/ags"    title="Map" creationComplete="pointsXML.send()" viewActivate="init()">  <fx:Script>   <![CDATA[    import com.esri.ags.Graphic;    import com.esri.ags.SpatialReference;    import com.esri.ags.events.GeometryServiceEvent;    import com.esri.ags.geometry.Geometry;    import com.esri.ags.geometry.MapPoint;        import flashx.textLayout.events.DamageEvent;        import mx.collections.ArrayCollection;    import mx.containers.VBox;    import mx.controls.Alert;    import mx.controls.Image;    import mx.controls.Label;    import mx.controls.List;    import mx.events.FlexEvent;    import mx.rpc.AsyncResponder;    import mx.rpc.events.FaultEvent;    import mx.rpc.events.ResultEvent;    import mx.utils.ObjectProxy;        import spark.components.Scroller;    import spark.components.TextArea;            [Bindable]    private var dataProxy:ObjectProxy;    private var pntList:XMLList;    private var attributes:Object;        private function init():void    {     pointsXML.send();       }    protected function pointsXML_resultHandler(event:ResultEvent):void    {     var gArr:Array = [];     var myGraphics:Array = [];          var x:XML = XML(event.result);     pntList = x..entry;     for (var i:int = 0; i < pntList.length(); i++){      var latlong:Array = pntList.point.split(" ");      attributes = new Object();      attributes.name = pntList.name; // attributes["name"]      attributes.region = pntList.region; // attributes["region"]      attributes.summary = pntList.summary; // attributes["summary"]                     var myPoint:Geometry = new MapPoint(latlong[1], latlong[0], new SpatialReference(4326));            var coordGraphic:Graphic = new Graphic(myPoint,null,attributes);            gArr.push(myPoint);      myGraphics.push(coordGraphic);           }     var outSR:SpatialReference = new SpatialReference(3857);     geometryService.project(gArr, outSR, new AsyncResponder(projectCompleteHandler, projectFault, myGraphics));        }         protected function projectFault(event:FaultEvent):void    {     Alert.show(event.fault.faultString);    }           protected function projectCompleteHandler(result:Object, token:Object):void    {     var pRslts:Array = result as Array;     for (var pg:int = 0; pg < pRslts.length; pg++)     {      var pGeom:Geometry = pRslts[pg];      token[pg].geometry = pGeom;      token[pg].addEventListener(MouseEvent.ROLL_OVER, mClick);      token[pg].addEventListener(MouseEvent.CLICK, click);     }         graphicsLayer.graphicProvider = token;    }       private function click(event:MouseEvent):void    {      var gra:Graphic = event.target as Graphic;     navigator.pushView(newView, gra.attributes);       }        private function mClick(event:MouseEvent):void    {     var gra:Graphic = event.target as Graphic;     var vbox:VBox = new VBox();     vbox.height = 20;     vbox.width = 150;          var label4:Label = new Label();     label4.text = gra.attributes.name.toString();     vbox.addChild(label4);          map.infoWindow.content = vbox;     map.infoWindow.closeButton.height = 0;      map.infoWindow.closeButton.width = 0;     map.infoWindow.show(gra.geometry as MapPoint);    }        protected function pointsXML_faultHandler(event:FaultEvent):void{     Alert.show(event.fault.message);    }         ]]>  </fx:Script>   <fx:Declarations>   <s:HTTPService id="pointsXML"          url="http://m.gstaadrealestateservices.com/android/properties.xml"          result="pointsXML_resultHandler(event)"          resultFormat="xml"          fault="pointsXML_faultHandler(event)"/>      <esri:GeometryService id="geometryService"           url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"/>  </fx:Declarations>  <s:navigationContent>   <s:Button width="80" height="70" click="navigator.popView()" icon="assets/backbutton.png"/>  </s:navigationContent>    <esri:Map id="map" x="0" y="0" height="690" openHandCursorVisible="false">   <esri:extent>    <esri:Extent xmin="-467799" ymin="5253018" xmax="2171419" ymax="6627661"/>   </esri:extent>   <esri:ArcGISTiledMapServiceLayer url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>   <esri:GraphicsLayer id="graphicsLayer">    <esri:symbol>     <esri:SimpleMarkerSymbol alpha="0.9"            color="0xedf2f7"            size="18"            style="circle">      <esri:SimpleLineSymbol color="0x003369" width="2" alpha="1" style="solid"/>     </esri:SimpleMarkerSymbol>    </esri:symbol>   </esri:GraphicsLayer>  </esri:Map> </s:View>
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
IvanBespalov
Occasional Contributor III
ann,
just fill the difference:

If 'someText' is not 'Bindable' property:
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"        xmlns:s="library://ns.adobe.com/flex/spark">    <s:layout>   <s:VerticalLayout />  </s:layout>    <fx:Script>   <![CDATA[       import mx.controls.Alert;    import mx.utils.StringUtil;    private var someText:String = "some text";        protected function onSubmitClick(event:MouseEvent):void    {     someText = txtInput.text;          var message:String = StringUtil.substitute("someText value = '{0}'\ntxtInput text = '{1}'\nlblOutput text = '{2}'",       someText, txtInput.text, lblOutput.text);     Alert.show(message);    }    ]]>  </fx:Script>    <s:TextInput id="txtInput" />    <s:Button label="Submit"       click="onSubmitClick(event)" />    <s:Label id="lblOutput"      text="{someText}" />    <!-- Data binding will not be able to detect assignments to "someText" ... in line 33 ... -->  </s:Application>


If 'someText' is 'Bindable' property:
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"        xmlns:s="library://ns.adobe.com/flex/spark">    <s:layout>   <s:VerticalLayout />  </s:layout>    <fx:Script>   <![CDATA[       import mx.controls.Alert;    import mx.utils.StringUtil;        [Bindable]    private var someText:String = "some text";        protected function onSubmitClick(event:MouseEvent):void    {     someText = txtInput.text;          var message:String = StringUtil.substitute("someText value = '{0}'\ntxtInput text = '{1}'\nlblOutput text = '{2}'",       someText, txtInput.text, lblOutput.text);     Alert.show(message);    }    ]]>  </fx:Script>    <s:TextInput id="txtInput" />    <s:Button label="Submit"       click="onSubmitClick(event)" />    <s:Label id="lblOutput"      text="{someText}" />  </s:Application>


If you need to know "What is data binding?" "How is it works?" take a look to adobe forums and resources.

P.S. as I understand, compiler generates warnings for code in your newView, but not for code you present.

View solution in original post

0 Kudos
1 Reply
IvanBespalov
Occasional Contributor III
ann,
just fill the difference:

If 'someText' is not 'Bindable' property:
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"        xmlns:s="library://ns.adobe.com/flex/spark">    <s:layout>   <s:VerticalLayout />  </s:layout>    <fx:Script>   <![CDATA[       import mx.controls.Alert;    import mx.utils.StringUtil;    private var someText:String = "some text";        protected function onSubmitClick(event:MouseEvent):void    {     someText = txtInput.text;          var message:String = StringUtil.substitute("someText value = '{0}'\ntxtInput text = '{1}'\nlblOutput text = '{2}'",       someText, txtInput.text, lblOutput.text);     Alert.show(message);    }    ]]>  </fx:Script>    <s:TextInput id="txtInput" />    <s:Button label="Submit"       click="onSubmitClick(event)" />    <s:Label id="lblOutput"      text="{someText}" />    <!-- Data binding will not be able to detect assignments to "someText" ... in line 33 ... -->  </s:Application>


If 'someText' is 'Bindable' property:
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"        xmlns:s="library://ns.adobe.com/flex/spark">    <s:layout>   <s:VerticalLayout />  </s:layout>    <fx:Script>   <![CDATA[       import mx.controls.Alert;    import mx.utils.StringUtil;        [Bindable]    private var someText:String = "some text";        protected function onSubmitClick(event:MouseEvent):void    {     someText = txtInput.text;          var message:String = StringUtil.substitute("someText value = '{0}'\ntxtInput text = '{1}'\nlblOutput text = '{2}'",       someText, txtInput.text, lblOutput.text);     Alert.show(message);    }    ]]>  </fx:Script>    <s:TextInput id="txtInput" />    <s:Button label="Submit"       click="onSubmitClick(event)" />    <s:Label id="lblOutput"      text="{someText}" />  </s:Application>


If you need to know "What is data binding?" "How is it works?" take a look to adobe forums and resources.

P.S. as I understand, compiler generates warnings for code in your newView, but not for code you present.
0 Kudos