7 Replies Latest reply on Aug 21, 2008 1:02 PM by vikceo

    Custom component

    vikceo Level 1
      Hie

      I am extended my component from UIComponent and defined a property of type array in it.
      i use it in my app as:
      <components:NewComp id="abc" myData={resultSet()} />

      where myData is a property of type array and resultSet rerurns an arrays or strings.
      But in the component class i m getting null always..

      however if i define a string or int property it works as desired and i can see the value.. in the setter method of the component class...

      any clues?
        • 1. Re: Custom component
          g-s-b Level 1
          I think some code would help.

          • 2. Re: Custom component
            vikceo Level 1
            ok
            this is the component code:

            public class NewAccordion extends UIComponent
            {
            public function NewAccordion()
            {
            super();
            }

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

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

            and other methods like commitProperties etc.. (i just implemented as default calling super)

            and in mxml i have written it as:
            <components:NewAccordion id="newAccord" width="100%" compData="{getHeads()}">
            </components:NewAccordion>

            and the method getHeads is implemented as:
            public function getHeads():Array{
            var arr:ArrayCollection;
            arr.addItem("vik");
            arr.addItem("neeti");
            arr.addItem("Alan");
            return arr.toArray();
            }

            please suggest...
            • 3. Re: Custom component
              vikceo Level 1
              any updates please?
              • 4. Re: Custom component
                Level 7

                "vikceo" <webforumsuser@macromedia.com> wrote in message
                news:g8i975$m56$1@forums.macromedia.com...
                > ok
                > this is the component code:
                >
                > public class NewAccordion extends UIComponent
                > {
                > public function NewAccordion()
                > {
                > super();
                > }
                >
                > private var _compData:Array;
                > public function set compData(value:Array ) : void{
                > _compData = value;
                > Alert.show(_compData.length.toString());
                > invalidateProperties();
                > }
                >
                > public function get compDate() : Array
                > {
                > return _compData;
                > }
                > }

                Maybe the problem is your getter has a different name from your setter.

                HTH;

                Amy


                • 5. Re: Custom component
                  vikceo Level 1
                  Well i posted the whole code above? so getter and setter names are same.. in what way you think it is an issue?

                  please suggest
                  • 6. Re: Custom component
                    Level 7

                    "vikceo" <webforumsuser@macromedia.com> wrote in message
                    news:g8kdeu$p8q$1@forums.macromedia.com...
                    > Well i posted the whole code above? so getter and setter names are same..
                    > in what way you think it is an issue?
                    >
                    > please suggest

                    In the code you posted, they are NOT the same.


                    • 7. Re: Custom component
                      vikceo Level 1
                      Thankx a lot.. silly me... it was a real stupid mistake and was not able to locate for hours...