1 Reply Latest reply on Oct 19, 2010 11:58 PM by Shongrunden

    service call returns nothing in Item Renderer

    JoGlez Level 1

      Hi Guys!!

       

          Well my problem is that from my main app I call an item renderer which is supposed to get the necesarry data from my webservice, create a chart and display it.  Problem is that the service call is coming back blank..nothing at all. but in my main app any service call works just fine...  I'm going to post my code in case you guys see something a work around would be great!!! Thanks!

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:s="library://ns.adobe.com/flex/spark"
                      xmlns:mx="library://ns.adobe.com/flex/mx"
                      xmlns:datacollector="services.datacollector.*"
                      autoDrawBackground="true"
                      creationCompleteEffect="{cce}" creationComplete="onComplete()" color="#FFFFFF"    >
      <fx:Script>
          <![CDATA[
              import mx.charts.PieChart;
              import mx.charts.series.PieSeries;
              import mx.collections.ArrayCollection;
              import mx.controls.Alert;
              import mx.controls.Image;
              import mx.controls.Label;
              import mx.events.FlexEvent;
                    
              public var array:ArrayCollection = new  ArrayCollection();
              public var myPieChart:PieChart;
              public var seriesP1:PieSeries;
             
              protected function onComplete():void{
                 
                  result.token = DataCollector.getAverage("School 1");
                 
                  /* Create the chart object and set some basic properties. */


                  myPieChart = new PieChart();
                  myPieChart.showDataTips = true;
                  myPieChart.dataProvider = result.lastResult;
                  myPieChart.maxHeight=250;
                  myPieChart.maxWidth=380;
                 
                 
                  /* Add the series. */


                  var mySeries:Array=new Array();
                  seriesP1 = new PieSeries();
                  seriesP1.field="PowerAverage";
                  seriesP1.nameField = "PowerName";
                  seriesP1.displayName="PowerName";
                  mySeries.push(seriesP1);
                 
                  myPieChart.series = mySeries;
                 
                  this.addElement(myPieChart);
                  }
             
          ]]>
      </fx:Script>
         
      <fx:Declarations>
          <datacollector:DataCollector id="DataCollector"  />
          <s:CallResponder id="result"/>
          <s:Fade id="cce" alphaFrom="0" alphaTo="1" duration="500" />


      </fx:Declarations>


              <s:SkinnableContainer height="100%" width="100%" styleName="drillDownReport"/>     

       

      </s:ItemRenderer>