Well,

Basically, if you subclass a UIComponent or decendent, and you are making a
component that uses setters that 'communicate' with composite children, I
would always use this algorithm.

As far as the randomness, might have to do with bindings, other timing
issues. If you set a property in mxml it will always be called before
children are created, you can count on that.

Mike

On Thu, Sep 18, 2008 at 6:57 AM, Manu Dhanda <[EMAIL PROTECTED]>wrote:

>
> Thanks for the answer Mik.
>
> But, Isn't it strange that this situation can occur randomly??
> Or is there any particular case, when we always need to use the solution,
> like the one you provided.
>
> I am asking it because I had written other components in my code where
> everything is working seamlessly and I am worried now as if they are error
> prone??
>
> Thanks,
> Manu.
>
>
> Michael Schmalle wrote:
> >
> > Hi Manu,
> >
> > This is a pretty simple answer. The reason is the mxml properties get
> > looped
> > into your component before createChildren() creates the child
> descriptors.
> >
> > This is why we need the invalidation system. You need the following.
> >
> > public function set data(value:ArrayCollection) {
> > _data = value;
> > dataChanged = true;
> > invalidateProperties();
> > }
> >
> > ... in the same class
> >
> > override protected function commitProperties()
> > {
> > super.commitProperties()
> > if (dataChanged)
> > {
> > // do things with child components IE
> > myGrid.data = _data;
> > dataChanged = false
> > }
> > }
> >
> >
> > Setting your child properties in commitProperties() guarantees your
> > children
> > will be created.
> >
> > Peace,
> > Mik
> >
> >
> >
> > On Thu, Sep 18, 2008 at 3:09 AM, Manu Dhanda
> > <[EMAIL PROTECTED] <manuraj.dhanda%40gmail.com>>wrote:
> >
> >>
> >> Hii Guyz,
> >>
> >> I am having some strange issue here.
> >>
> >> What I am doing is:
> >>
> >> <comps:CustomUIComponent Data="{_dataP}"/>
> >>
> >> I am using this component in some abc.mxml as above.
> >>
> >> Data is something like:
> >>
> >> public function set Data(value:ArrayCollection){
> >> //set ur data here.
> >> }
> >>
> >> But strangely, when I do it(pay attention to bold mxml code of line
> above
> >> now), I find one of flex components (say a Grid) in my CustomUIComponent
> >> as
> >> null, on which I want to set this Data.
> >>
> >> Now, I am worried like how a method, say "set Data" can be called before
> >> even creation complete of CustomUIComponent.
> >>
> >> Can someone please put some light here..
> >>
> >> Thanks,
> >> Manu.
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/UI-component%2C-a-set-function---creationComplete-tp19547254p19547254.html
> >> Sent from the FlexCoders mailing list archive at Nabble.com.
> >>
> >>
> >>
> >
> >
> >
> > --
> > Teoti Graphix, LLC
> > http://www.teotigraphix.com
> >
> > Teoti Graphix Blog
> > http://www.blog.teotigraphix.com
> >
> > You can find more by solving the problem then by 'asking the question'.
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/UI-component%2C-a-set-function---creationComplete-tp19547254p19550295.html
> Sent from the FlexCoders mailing list archive at Nabble.com.
>
>  
>



-- 
Teoti Graphix, LLC
http://www.teotigraphix.com

Teoti Graphix Blog
http://www.blog.teotigraphix.com

You can find more by solving the problem then by 'asking the question'.

Reply via email to