4 Replies Latest reply on Aug 22, 2008 11:26 AM by vikceo

    Passing array as a property to a custom component

    vikceo
      I am trying to pass an array to a custom component like:
      <components:NewAccordion id="newAccord" width="100%" compData="{getHeads()}" />

      where getHeads() returns me an array of strings.

      Code for the component is like:
      public class NewAccordion extends UIComponent
      {
      public function NewAccordion()
      {
      super();
      }

      public var _compData:Array;
      public function set compData(value:Array ) : void{
      _compData = value;
      Alert.show(_compData.length.toString());
      invalidateProperties();
      }

      public function get compData() : Array
      {
      return _compData;
      }

      override protected function commitProperties():void
      {
      super.commitProperties();
      if(_compData == null)
      Alert.show("its null");
      }
      }


      Well notice the Alert in the setter method.. which is never called when i run the page.. I am not sure why... and i think in commitProperties() it is obvious that it is alerting null (as setter is not called)..

      any suggestions please...