flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com>
Subject Re: [FlexJS] About Component Cycle and Events
Date Tue, 13 Dec 2016 23:32:48 GMT

On 12/13/16, 1:14 PM, "carlos.rovira@gmail.com on behalf of Carlos Rovira"
<carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com> wrote:

>Hi Alex,
>I'm trying to get a mental picture of the overall structure, events and
>when to expect to have data.
>As you see, my problem with data was in item renderers. I see I have
>available in set data method (overriding it).
>Maybe in others components I don't have problem right now.

You can override set data(), or in MXMLItemRenderer there is now a
dataChange event.  The override is more efficient, but dataChange might be
easier to work with.

IMO, there will be fewer events because we don't have to stop to let the
player render.  Events were important in asynchronous code, but in the
browser, you can just run code that updates the UI and it generally
happens immediately.

The LifeCycle is much simpler:  Instantiate, (optionally set properties),
addChild.  On addChild, lots of things happen in the child's
addedToParent: some default beads get placed on the strand, the element is
placed in the DOM causing styles to be rendered by the browser.  But then
the component should be done, and some components send out an initComplete

>Another scenario I'm dealing with are beads, it seems we can do all things
>in set strand method, but not in getter/setters. the next step in MDL
>library, now that we have the right HTML structure created, is check that
>events and changes are working right. This right now is not true in the
>global set, and would be the next thing to do. For example, the click in
>buttons is working, but as we see the slider was not dispatching the
>valueChanged event (then Peter fixed it in HTML and as I have some time
>I'll come back to MDL slider).

Beads have a different lifecycle, but it is similar:  Instantiate,
(optionally set properties), addBead.  On addBead, the strand setter is
called, that's a good time to do most work because the host strand should
be in the DOM at that point.

If that's not a good time, then you have to listen for some events.  There
might be more events needed, but we aren't dispatching very many
"just-in-case" events.  Again, in PAYG, you should be able to replace any
instance with an instance that dispatches a useful event.


View raw message