2 Replies Latest reply on Jul 6, 2010 6:58 AM by VRPDeveloper

    Alternative method for Creationcomplete....

    jerry98225 Level 1

      Hi guys..

         I am trying to load bunch of product detail into a canvas component from a List component.

       

      Every time the user clicks on a product inside my List, the product detail will be displayed in the canvas component.

       

      The product detail might contain null and I want to check it before displaying in my canvas component. In my canvas component, I use createcomplete to check if the productDetail==null then do something.

       

      My problem is if the user clicks the product with the non-null detail first time, the statement "if (productDetail==null) then do something" won't work if the user click a null product detail because the canvas component has been created the first time user clicks a non-null product detail.

       

      I want to check if the productDetail==null every time the user click a product...I hope I explain my question well and appreciate any helps.

       

       

      My code..

       

      <s:List dataProvider={productData}/>  //when user click a product, the canvas will show product detail..

       

      <comp:canvas />  //if the product detail is null, the statement inside the canvas will check via creationComplete. but if the user click the non-null product, //the creationComplete check pass. User clicks a null product again, the check won't work anymore...

       

      code for my canvas component:

       

      protected function canvas1_creationCompleteHandler(event:FlexEvent):void

      {

      var undefinedBrand:String=dataFromClick.getItemAt(0).brand;

       

          if(undefinedBrand==null){   // I want to check every time the user click a List item

            brand.text="Brand: No Brand";

            switchView.enabled=false;

            displayPictureBig.source="assets/vacant.jpg";

           }

      }

       

       

      Thanks for the helps..