addchild problem

oscar's Avatar

oscar

15 Mar, 2010 04:26 PM

Hi,

One of my mediator (let's say mediator1) has a method that does several things (in the following order):
1. Dispatches an event that is received by another mediator and it adds a visual component to the display list.
2. Calls a method in mediator1, that sums the heights of all children in a view. The same view where the child in point 1 must be added.

The problem is that the child is added after point 2 is executed and I don't get the correct measures.

How can I avoid that? How can I make sure that the events and it's handlers are executed before continuing with the rest of the logic?

tks.

  1. 1 Posted by oscar on 15 Mar, 2010 04:45 PM

    oscar's Avatar

    I just noticed that the child is been added but it isn't completely created, so its height is 0.

  2. Support Staff 2 Posted by Joel Hooks on 15 Mar, 2010 04:47 PM

    Joel Hooks's Avatar

    So you might have the parent component listen on the child for CREATION_COMPLETE and notify the mediator that it is ready and then run the logic. I'm assuming this is Flex here, but the same principle could be applied with straight AS3.

  3. 3 Posted by oscar on 15 Mar, 2010 04:50 PM

    oscar's Avatar

    yeap, I thought on that solution, but is there a way to control or force things to happen right away? something like commitAllChanges() ?

  4. 4 Posted by oscar on 15 Mar, 2010 05:08 PM

    oscar's Avatar

    got it working with the creationComplete event.
    Thanks

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac