8 Replies Latest reply on Sep 16, 2010 7:56 PM by dantheinc

    1119: Access of possibly undefined property dataProvider Error

    dantheinc

      I get an 1119: Access of possibly undefined property dataProvider through a reference with static type mx.controls:Label. error at the bolded line.

      all i want to do is pass the info from my data grid into my shopping cart via a tv class.  Not sure how to fix,  can someone please advise would be grateful.

       

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:ns1="comp.*"
          creationComplete="getData.send();">
         
          <mx:Script>
              <![CDATA[
                 
                  import mx.rpc.events.FaultEvent;
                  import mx.rpc.events.ResultEvent;
                  import mx.events.ItemClickEvent;
                  import mx.events.CollectionEvent;
                  import mx.collections.ArrayCollection;
                  import valueObjects.*;
                 
                  [Bindable]
                  private var blurayArray:ArrayCollection=new ArrayCollection();
                  [Bindable]
                  private var tvgridArray:ArrayCollection=new ArrayCollection();
                 
                  private var total:Number=0;
                 
                 
                  private function resultHandler(evt:ResultEvent):void
                  {
                      blurayArray=evt.result.device.bluray.machine;
                      compBluraydvd.dgrBluraydvd.dataProvider=blurayArray;
                  }
                 
                  private function faultHandler(evt:FaultEvent):void
                  {
                      var faultInfo:String="fault code: "+evt.fault.faultCode+"\n\n";
                      faultInfo+="fault string: "+evt.fault.faultString+"\n\n";
                      mx.controls.Alert.show(faultInfo,"Fault Information");       
                  }
                 
                  private function addToBluDisplay():void
                  {
                      var price:Number=Number(compBluraydvd.dgrBluraydvd.selectedItem.price);
                      var item:String=compBluraydvd.dgrBluraydvd.selectedItem.name;
                      total=total+price;
                     
                     
                      compShoppingcart.lblCart.text+="\nProduct Name: "+name+ "\nPrice: "+price;
                      compShoppingcart.lblTotal.text="Total $"+total;
                     
                  }
                  private function addToTvDisplay():void
                  {
                      var price:Number=Number(compTv.dgrTv.selectedItem.Price);
                      var resolution:String=compTv.dgrTv.selectedItem.Resolution;
                      var name:String=compTv.dgrTv.selectedItem.ProductName;

       

                      total=total+price;
                     
                      var theTv:Tv=new Tv(name,resolution,price);
                      tvgridArray.addItem(theTv);   
                      compShoppingcart.lblCart.dataProvider=tvgridArray;       
                     
                    
                     
                  }
                 
                 
              ]]>
          </mx:Script>
          <mx:HTTPService id="getData" url="xml/bluray.xml" result="resultHandler(event);"
              fault="faultHandler(event);"/>

       

          <mx:Style source="css/sim3.css"/>
          <mx:VBox width="949" height="702" backgroundColor="#BCAD84" horizontalAlign="center">

       

              <mx:Label text="DIRT CHEAP ELECTRONICS" width="518" fontSize="28" fontFamily="Georgia" textAlign="center" fontWeight="bold"/>
                  <mx:LinkBar dataProvider="viewstack1" borderStyle="solid" width="836" fontSize="19" fontFamily="Times New Roman" color="#D52113"/>
                      <mx:ViewStack id="viewstack1" resizeToContent="true" height="600" width="830">
                              <ns1:bluraydvd id="compBluraydvd" label="BluRaydvd" width="820" height="550" backgroundColor="#ECEEB3"                          addBluDisplay="addToBluDisplay();"/>
                              <ns1:home id="home" label="Home" width="900" height="602"/>
                              <ns1:tv id="compTv" label="Tv" width="820" height="550" backgroundColor="#F2F3D6"  addTvDisplay="addToTvDisplay();"/>
                              <ns1:audio id="audio" label="Audio" width="820" height="550" backgroundColor="#EFF2A6"/>
                              <ns1:shoppingcart id="compShoppingcart" label="Shopping Cart" width="820" height="550" backgroundColor="#ECEF99" />
                             
                             
                      </mx:ViewStack>
                         
             
          </mx:VBox>
         
      </mx:WindowedApplication>

       

      If anymore info is needed i can supply it, it goes through a component called tv and shopping cart.

      regards