2 Replies Latest reply on Aug 30, 2012 3:55 AM by l33tian

    Data binding will not be able to detect....

    fsoender Level 1

      I need some help with my code.

      I got this error: Data binding will not be able to detect assignment to "chartData".

      Marked with "HERE"

       

      Code:

       

      <?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" applicationDPI="160"

                              xmlns:mx="library://ns.adobe.com/flex/mx"

                              applicationComplete="applicationCompleteHandler(event)">

             <fx:Script>

                    <![CDATA[

                           import be.aboutme.nativeExtensions.udp.UDPSocket;                   

                           import mx.events.FlexEvent;             

                           private var udpSocket:UDPSocket;

                           public var NewValue:Object;      

                           public var Value:String;

                          

                           [Bindable]                

                           private var chartIndex:int = 0;

                           private var chartData:ArrayCollection = new ArrayCollection;

                           import mx.collections.ArrayCollection;

                          

                          

                           protected function applicationCompleteHandler(event:FlexEvent):void

                           {

                                 udpSocket = new UDPSocket();

                                 udpSocket.addEventListener(DatagramSocketDataEvent.DATA, udpDataHandler);

                                 udpSocket.bind(1000);

                                 udpSocket.receive();

                           }

                          

                          

                          

                          

                           protected function udpDataHandler(event:DatagramSocketDataEvent):void

                           {

                                 var Value:String = event.data.readUTFBytes(event.data.bytesAvailable);

                                

                                 if(Value)

                                 {

                                       

                                        NewValue = Value;

                                        Test.appendText(Value);

                                        chartData.source[chartIndex] = NewValue;

                                       

                                       

                                 }

                                 else

                                 {

                                       

                                        NewValue = 0;

                                       

                                 }

                           }

                          

                    ]]>

                   

                   

                   

                   

                   

             </fx:Script>

             <fx:Declarations>

                    <!-- Place non-visual elements (e.g., services, value objects) here -->

                    <mx:SolidColorStroke id="s3" color="0x33F400" weight="1"/>

             </fx:Declarations>

            

             <s:layout>          

                    <s:VerticalLayout paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10" />

             </s:layout>

            

             <s:Scroller width="100%" height="100%">

                    <s:VGroup width="100%">

                           <s:TextArea id="Test" width="100%" height="49" editable="false"/>

                           <s:HGroup width="100%">

                           </s:HGroup>

                    </s:VGroup>

             </s:Scroller>

            

            

             <mx:CartesianChart id="linechart" width="100%" height="207" cacheAsBitmap="true"

                                           cachePolicy="on" paddingLeft="5" paddingRight="5">

                   

                    <mx:verticalAxis>

                           <mx:LinearAxis id="vAxis" alignLabelsToInterval="true" autoAdjust="false"

                                                  baseAtZero="false" interval="16" maximum="256" minimum="0" padding="1"/>

                    </mx:verticalAxis>

                    <mx:verticalAxisRenderers>

                           <mx:AxisRenderer axis="{vAxis}" canDropLabels="true" color="0xF8F8F6" fontSize="8"/>

                    </mx:verticalAxisRenderers>

                    <mx:horizontalAxis>

                           <mx:LinearAxis id="hAxis" alignLabelsToInterval="true" autoAdjust="false"

                                                  baseAtZero="false" interval="25"/>

                    </mx:horizontalAxis>

                    <mx:horizontalAxisRenderers>

                           <mx:AxisRenderer axis="{hAxis}" canDropLabels="true" color="0xF8F8F6" fontSize="8"/>

                    </mx:horizontalAxisRenderers>

                    <mx:fill>

                           <mx:SolidColor color="0x231F20"/>

                    </mx:fill>

                    <mx:backgroundElements>

                           <mx:GridLines cacheAsBitmap="true" cachePolicy="on" gridDirection="horizontal">

                                 <mx:horizontalStroke>

                                        <s:SolidColorStroke alpha="0.2" color="0xD4D4D3" weight="0"/>

                                 </mx:horizontalStroke>

                           </mx:GridLines>

                    </mx:backgroundElements>

                    <mx:series>

        HERE --------->                   <mx:LineSeries id="recordGraph" cacheAsBitmap="true" cachePolicy="on"

                                                  dataProvider="{chartData}" form="curve" lineStroke="{s3}"

                                                  sortOnXField="false"/>

                    </mx:series>

             </mx:CartesianChart>

            

            

            

            

            

      </s:Application>