Skip navigation
GeorgeWS
Currently Being Moderated

OnChange

Mar 9, 2010 2:00 PM

I have a combobox on my main when I select a supplier I want the Supplier Component to Run its init() with the new supplier number. I cannot figure out how the componet knows when/how to fire the init() that would fire of my RO with the new SupplierID.

 

My main has a combobox and this local, to bring in the component:

 

<local:SupplierContent/>

 

So change the Combobox and the above would reload with the new supplier number. The RO and init() are all in the SupplierContent.

 

Any thoughts?

Thanks

 

George

  • Currently Being Moderated
    Community Member
    Mar 9, 2010 10:30 PM

    in the change handler of your combobox you can create new instance of SupplierContent with the new selected supplier number.

     

    private function changeHandler():void{

         var supplierContentObj:SupplierContent = new SupplierContent();

         this.addChild(supplierContentObj)

    }

    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Mar 10, 2010 9:38 PM

    private function changeHandler():void{

         if(supplierContentObj){

              this.removeChild(supplierContentObj);

              supplierContentObj = null;

         }

         var supplierContentObj:SupplierContent = new SupplierContent();

         this.addChild(supplierContentObj);

    }

     

    Whenever a new instance of a component is created, the creationComplete event is dispatched. So, assuming that init() is the creationComplete eventHandler, this will also be called on every new instance creation.

    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Mar 10, 2010 10:32 PM

    Simple...

     

    private function comboChangehandler():void

    {

             this.addChild(s1)

             s1.init();

    }

     

    <local:SupplierContent id ="s1"/>

     

     

    thats it...

    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points