0 Replies Latest reply on May 21, 2009 11:12 AM by rcanulla

    How do communicate between components?


      I have a two compoonents, a news feed & a chart. My user will select important feed items and archive them to an ArrayCollection. I want to set that array as the data provider for my chart. I can access the arrayCollection from the main application via componentID.arrayVar.


      Component "newsFeed" contains the array.

      <mx:TabNavigator id="navigator" width="450" height="89%"  x="20" y="61">
                <mx:VBox label="News">
                     <com:listItems id="newsFeed" backgroundColor="#FFFFFF" x="0" y="0" height="100%">


      Chart Component


           <com:currentArchiveChart x="478" y="81" height="212" />


      LIstItems Component array


                public var newsDB:ArrayCollection = new ArrayCollection;

      Chart Component


      <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="300" height="346" xmlns:com="components.*" creationComplete="init()" >
              import mx.collections.ArrayCollection;
                // testing variable
              private var medalsAC:ArrayCollection = new ArrayCollection( [
                  { Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
                  { Country: "China", Gold: 32, Silver:17, Bronze: 14 },
                  { Country: "Russia", Gold: 27, Silver:27, Bronze: 38 } ]);
              private function init():void{
                   trace("chart created");
              private function displayGold(data:Object, field:String, index:Number, percentValue:Number):String {
                  var temp:String= (" " + percentValue).substr(0,6);
                  return data.Country + ": " + '\n' + "Total Gold: " + data.Gold + '\n' + temp + "%";
               <mx:Label x="10" y="10" text="Current Archive " fontSize="14" fontWeight="bold"/>
               <mx:PieChart id="chart" height="211" width="300" color="0x323232"
                  showDataTips="false" dataProvider="{}"  y="0">
                      <mx:PieSeries labelPosition="callout" field="Gold" labelFunction="displayGold">
                              <mx:Stroke weight="0" color="0x888888" alpha="1.0"/>
                              <mx:Stroke weight="0" color="#FFFFFF" alpha="0.20"/>
                              <mx:Stroke color="0" alpha="0.20" weight="2"/>


      How would I say access this id from the parent of the currentItem?