flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cristina Constantinescu <cristina.constantine...@crispico.com>
Subject Re: notify components when their global coordinates are changing
Date Wed, 10 Jul 2013 13:21:17 GMT
Example:
<s:Group id="canvas" width="100" height="100">
         <s:layout>
             <s:BasicLayout />
         </s:layout>

         <s:Group id="component" x="10" y="10" width="20" height="20">
             <s:layout>
                 <s:BasicLayout />
             </s:layout>
             <s:VGroup id="child1" x="0" y="0" width="10" height="10"/>
             <s:VGroup id="child2" x="10" y="5" width="10" height="10"/>
         </s:Group>

         <s:Image id="image" />
         ...
  </s:Group>

What I need: when "child1" changes its coordinates (relative to 
"canvas"), the "image"coordinates  are modified in some way.
So, this happens when:
1. "component" changes dimensions/coordinates
2. children changes their order in parent (e.g. "child2" becomes first 
element)

Can "child1" be notified about these type of changes?

Regards,
Cristina

On 10.07.2013 15:10, Cristina Constantinescu wrote:
> Hello,
>
> Is there a way to notify children when parent changes its 
> dimensions/coordinates?
>
> For the moment, my solution is to add a resize event listener on parent.
> When the event is dispatched, the child gets its global coordinates 
> and uses them to position some additional components.
>
> Is there another approach for this?  (like each child to be notified 
> somehow when their global coordinates are changing)
>
> Thanks,
> Cristina


Mime
View raw message