Re: [flexcoders] What is the a correct lifecycle phase to add new child components?

2011-09-11 Thread Douglas Knudsen
you can catch a bit of what virtualization is here
http://adobe.ly/pVpLWQ
its been a part of Flex since wow, 1.5 days if I can recall back that far.


Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it?


On Thu, Sep 8, 2011 at 4:43 AM, Nick Middleweek n...@middleweek.co.ukwrote:

 **


 Doug, what's that?



 On 7 September 2011 20:48, Douglas Knudsen douglasknud...@gmail.comwrote:

 **


 also keep in mind virtualization use in Lists.  Just one more cog in The
 Wheel That Depends

 Douglas Knudsen
 http://www.cubicleman.com
 this is my signature, like it?


 On Wed, Sep 7, 2011 at 3:21 PM, Nick Middleweek n...@middleweek.co.ukwrote:

 **


 Alex,

 That's a good idea... What's your thoughts on approach to implement a
 shared Button?

 Would you create it at the parent view level and inject into the IR's
 using some kind of IFactory or perhaps attach it to the data property?


 Cheers,
 Nick



 On 7 September 2011 17:27, Alex Harui aha...@adobe.com wrote:

 **


 Yes, it is a set of trade-offs.  Deferring until you know you need it is
 best for memory and startup time, but you have to pay for the adding later.
  You can cache the button so you don’t always create a new one.  You can
 even share a button between all renderers if you want.



 On 9/7/11 5:42 AM, ganaraj p r ganara...@gmail.com wrote:






 With toggling the visibility property you are creating 1 Button per Item
 Renderer.

 When you are creating an object each time a user's mouse is over it, and
 then deleting it when its out, you are creating 'n' number of objects and
 deleting them , the new objects need to be garbage collected.

 The initial load is going to be more ofcourse, but then its a set number
 since you are only going to be creating a set number of buttons.

 On Wed, Sep 7, 2011 at 10:23 AM, Nick Middleweek n...@middleweek.co.uk
 wrote:






 Alex,

 Just checking/ thinking... But if I go down the visibility route and
 addChild( x ) up front in createChildren() would I be consuming more 
 initial
 memory than if I addChild( x ) as and when I needed it?

 In my case, I have 15 columns, using the same renderer and 40 rows so
 that's 600 extra buttons that would be created that are initially set
 visible = false;

 I'm assuming they are all in memory and when scrolling, this could
 impact scroll performance.


 Or is adding/ removing children dynamically and making each Item
 Renderer go through it's update cycle more expensive?


 Cheers,
 Nick




 On 6 September 2011 19:48, Alex Harui aha...@adobe.com wrote:






 States are still available in the MX way.  You can also hide and show
 instead of add and remove.

 Known children should be created in createChildren or in states.  But
 otherwise, you have to create them when you know you need them.  The List
 components create them in updateDisplayList since that’s when they finally
 know how many to create.



 On 9/6/11 10:48 AM, Nick Middleweek n...@middleweek.co.uk 
 http://n...@middleweek.co.uk  wrote:






 Thanks for this... So I'm extending UIComponent, does this mean I'm
 doing it the MX way?

 Cheers...


 On 6 September 2011 14:38, Haykel BEN JEMIA hayke...@gmail.com 
 http://hayke...@gmail.com  wrote:






 Hi Nick,

 if you use Spark components and the child components you want to add are
 fixed and known, e.g. a 'close' button that should be visible on 
 mouse-over,
 then I would use skin states and manage visibility of the components in the
 skin.

 Haykel Ben Jemia

 Allmas
 Web  RIA Development
 http://www.allmas-tn.com





 On Tue, Sep 6, 2011 at 10:28 AM, Nick Middleweek n...@middleweek.co.uk
 http://n...@middleweek.co.uk  wrote:






 Hi,

 I've been trying to find the correct 'place' to create new components
 after the parent component is UPDATE_COMPLETE.

 During initialisation, we create child components in *createChildren()*but 
 where/ when should we create them for e.g. in response to a mouseOver or
 a mouseClick event?

 Is it simply 'ok' to *this.addChild( *myNewButton *)* in a MOUSE_EVENT
 function handler or should I be setting some dirty flag to trigger off an
 invalidation and then add the button in a lifecycle override function?


 Thanks,
 Nick


 --
 Alex Harui
 Flex SDK Team
 Adobe System, Inc.
 http://blogs.adobe.com/aharui




 --
 Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774
 035 5424, blog: http://www.middleweek.co.uk } );






 --
 Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774
 035 5424, blog: http://www.middleweek.co.uk } );


  



Re: [flexcoders] What is the a correct lifecycle phase to add new child components?

2011-09-08 Thread Nick Middleweek
Alex,

Not sure if I've overlooked something but how can the blue focus rectangle
help?


Cheers,
Nick



On 8 September 2011 03:11, Alex Harui aha...@adobe.com wrote:

 **


 I think I’d just hack it in.  You can probably hang it off of the DG when
 not used and grab it from there when needed.  The parent of the blue focus
 rectangle is shared among all Flex components in an app.





Re: [flexcoders] What is the a correct lifecycle phase to add new child components?

2011-09-08 Thread Nick Middleweek
Doug, what's that?



On 7 September 2011 20:48, Douglas Knudsen douglasknud...@gmail.com wrote:

 **


 also keep in mind virtualization use in Lists.  Just one more cog in The
 Wheel That Depends

 Douglas Knudsen
 http://www.cubicleman.com
 this is my signature, like it?


 On Wed, Sep 7, 2011 at 3:21 PM, Nick Middleweek n...@middleweek.co.ukwrote:

 **


 Alex,

 That's a good idea... What's your thoughts on approach to implement a
 shared Button?

 Would you create it at the parent view level and inject into the IR's
 using some kind of IFactory or perhaps attach it to the data property?


 Cheers,
 Nick



 On 7 September 2011 17:27, Alex Harui aha...@adobe.com wrote:

 **


 Yes, it is a set of trade-offs.  Deferring until you know you need it is
 best for memory and startup time, but you have to pay for the adding later.
  You can cache the button so you don’t always create a new one.  You can
 even share a button between all renderers if you want.



 On 9/7/11 5:42 AM, ganaraj p r ganara...@gmail.com wrote:






 With toggling the visibility property you are creating 1 Button per Item
 Renderer.

 When you are creating an object each time a user's mouse is over it, and
 then deleting it when its out, you are creating 'n' number of objects and
 deleting them , the new objects need to be garbage collected.

 The initial load is going to be more ofcourse, but then its a set number
 since you are only going to be creating a set number of buttons.

 On Wed, Sep 7, 2011 at 10:23 AM, Nick Middleweek n...@middleweek.co.uk
 wrote:






 Alex,

 Just checking/ thinking... But if I go down the visibility route and
 addChild( x ) up front in createChildren() would I be consuming more initial
 memory than if I addChild( x ) as and when I needed it?

 In my case, I have 15 columns, using the same renderer and 40 rows so
 that's 600 extra buttons that would be created that are initially set
 visible = false;

 I'm assuming they are all in memory and when scrolling, this could impact
 scroll performance.


 Or is adding/ removing children dynamically and making each Item Renderer
 go through it's update cycle more expensive?


 Cheers,
 Nick




 On 6 September 2011 19:48, Alex Harui aha...@adobe.com wrote:






 States are still available in the MX way.  You can also hide and show
 instead of add and remove.

 Known children should be created in createChildren or in states.  But
 otherwise, you have to create them when you know you need them.  The List
 components create them in updateDisplayList since that’s when they finally
 know how many to create.



 On 9/6/11 10:48 AM, Nick Middleweek n...@middleweek.co.uk 
 http://n...@middleweek.co.uk  wrote:






 Thanks for this... So I'm extending UIComponent, does this mean I'm doing
 it the MX way?

 Cheers...


 On 6 September 2011 14:38, Haykel BEN JEMIA hayke...@gmail.com 
 http://hayke...@gmail.com  wrote:






 Hi Nick,

 if you use Spark components and the child components you want to add are
 fixed and known, e.g. a 'close' button that should be visible on mouse-over,
 then I would use skin states and manage visibility of the components in the
 skin.

 Haykel Ben Jemia

 Allmas
 Web  RIA Development
 http://www.allmas-tn.com





 On Tue, Sep 6, 2011 at 10:28 AM, Nick Middleweek n...@middleweek.co.uk
 http://n...@middleweek.co.uk  wrote:






 Hi,

 I've been trying to find the correct 'place' to create new components
 after the parent component is UPDATE_COMPLETE.

 During initialisation, we create child components in *createChildren()*but 
 where/ when should we create them for e.g. in response to a mouseOver or
 a mouseClick event?

 Is it simply 'ok' to *this.addChild( *myNewButton *)* in a MOUSE_EVENT
 function handler or should I be setting some dirty flag to trigger off an
 invalidation and then add the button in a lifecycle override function?


 Thanks,
 Nick


 --
 Alex Harui
 Flex SDK Team
 Adobe System, Inc.
 http://blogs.adobe.com/aharui




 --
 Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774
 035 5424, blog: http://www.middleweek.co.uk } );



  




-- 
Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774
035 5424, blog: http://www.middleweek.co.uk } );


Re: [flexcoders] What is the a correct lifecycle phase to add new child components?

2011-09-07 Thread Nick Middleweek
Douglas, Thanks...

So as a rule of thumb, add all children that I know I need up front and
show/ hide them using visibility in e.g. onMouseOver/ Out.

Or set a dirty flag and then invalidateDisplayList(), then from within
updateDisplayList(), check the dirty flags and addChild( x ) in there...


cool.
thanks!


p.s. yeah I like it :)



On 6 September 2011 20:35, Douglas Knudsen douglasknud...@gmail.com wrote:

 **


 ze MX way, yes.  So, um, I suggest you look at the visible property.
  Adding the child once in createChildren() then managing the visible
 property sounds better in the long run. If you really must add/remove the
 button, I'd say use updateDisplayList(), a good place for adding/removing
 dynamic children.

 There's a crap ton of info on the life cycle, here is one such source

 http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf68641-7ff0.html


 Douglas Knudsen
 http://www.cubicleman.com
 this is my signature, like it?





Re: [flexcoders] What is the a correct lifecycle phase to add new child components?

2011-09-07 Thread Nick Middleweek
Alex,

Just checking/ thinking... But if I go down the visibility route and
addChild( x ) up front in createChildren() would I be consuming more initial
memory than if I addChild( x ) as and when I needed it?

In my case, I have 15 columns, using the same renderer and 40 rows so that's
600 extra buttons that would be created that are initially set visible =
false;

I'm assuming they are all in memory and when scrolling, this could impact
scroll performance.


Or is adding/ removing children dynamically and making each Item Renderer go
through it's update cycle more expensive?


Cheers,
Nick




On 6 September 2011 19:48, Alex Harui aha...@adobe.com wrote:

 **


 States are still available in the MX way.  You can also hide and show
 instead of add and remove.

 Known children should be created in createChildren or in states.  But
 otherwise, you have to create them when you know you need them.  The List
 components create them in updateDisplayList since that’s when they finally
 know how many to create.


 On 9/6/11 10:48 AM, Nick Middleweek n...@middleweek.co.uk wrote:






 Thanks for this... So I'm extending UIComponent, does this mean I'm doing
 it the MX way?

 Cheers...


 On 6 September 2011 14:38, Haykel BEN JEMIA hayke...@gmail.com wrote:






 Hi Nick,

 if you use Spark components and the child components you want to add are
 fixed and known, e.g. a 'close' button that should be visible on mouse-over,
 then I would use skin states and manage visibility of the components in the
 skin.

 Haykel Ben Jemia

 Allmas
 Web  RIA Development
 http://www.allmas-tn.com





 On Tue, Sep 6, 2011 at 10:28 AM, Nick Middleweek n...@middleweek.co.uk
 wrote:






 Hi,

 I've been trying to find the correct 'place' to create new components after
 the parent component is UPDATE_COMPLETE.

 During initialisation, we create child components in *createChildren()*but 
 where/ when should we create them for e.g. in response to a mouseOver or
 a mouseClick event?

 Is it simply 'ok' to *this.addChild( *myNewButton *)* in a MOUSE_EVENT
 function handler or should I be setting some dirty flag to trigger off an
 invalidation and then add the button in a lifecycle override function?


 Thanks,
 Nick


 --
 Alex Harui
 Flex SDK Team
 Adobe System, Inc.
 http://blogs.adobe.com/aharui

  




-- 
Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774
035 5424, blog: http://www.middleweek.co.uk } );


Re: [flexcoders] What is the a correct lifecycle phase to add new child components?

2011-09-07 Thread ganaraj p r
With toggling the visibility property you are creating 1 Button per Item
Renderer.

When you are creating an object each time a user's mouse is over it, and
then deleting it when its out, you are creating 'n' number of objects and
deleting them , the new objects need to be garbage collected.

The initial load is going to be more ofcourse, but then its a set number
since you are only going to be creating a set number of buttons.

On Wed, Sep 7, 2011 at 10:23 AM, Nick Middleweek n...@middleweek.co.ukwrote:

 **


 Alex,

 Just checking/ thinking... But if I go down the visibility route and
 addChild( x ) up front in createChildren() would I be consuming more initial
 memory than if I addChild( x ) as and when I needed it?

 In my case, I have 15 columns, using the same renderer and 40 rows so
 that's 600 extra buttons that would be created that are initially set
 visible = false;

 I'm assuming they are all in memory and when scrolling, this could impact
 scroll performance.


 Or is adding/ removing children dynamically and making each Item Renderer
 go through it's update cycle more expensive?


 Cheers,
 Nick




 On 6 September 2011 19:48, Alex Harui aha...@adobe.com wrote:

 **


 States are still available in the MX way.  You can also hide and show
 instead of add and remove.

 Known children should be created in createChildren or in states.  But
 otherwise, you have to create them when you know you need them.  The List
 components create them in updateDisplayList since that’s when they finally
 know how many to create.


 On 9/6/11 10:48 AM, Nick Middleweek n...@middleweek.co.uk wrote:






 Thanks for this... So I'm extending UIComponent, does this mean I'm doing
 it the MX way?

 Cheers...


 On 6 September 2011 14:38, Haykel BEN JEMIA hayke...@gmail.com wrote:






 Hi Nick,

 if you use Spark components and the child components you want to add are
 fixed and known, e.g. a 'close' button that should be visible on mouse-over,
 then I would use skin states and manage visibility of the components in the
 skin.

 Haykel Ben Jemia

 Allmas
 Web  RIA Development
 http://www.allmas-tn.com





 On Tue, Sep 6, 2011 at 10:28 AM, Nick Middleweek n...@middleweek.co.uk
 wrote:






 Hi,

 I've been trying to find the correct 'place' to create new components
 after the parent component is UPDATE_COMPLETE.

 During initialisation, we create child components in *createChildren()*but 
 where/ when should we create them for e.g. in response to a mouseOver or
 a mouseClick event?

 Is it simply 'ok' to *this.addChild( *myNewButton *)* in a MOUSE_EVENT
 function handler or should I be setting some dirty flag to trigger off an
 invalidation and then add the button in a lifecycle override function?


 Thanks,
 Nick


 --
 Alex Harui
 Flex SDK Team
 Adobe System, Inc.
 http://blogs.adobe.com/aharui




 --
 Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774
 035 5424, blog: http://www.middleweek.co.uk } );


  




-- 
Regards,
Ganaraj P R


Re: [flexcoders] What is the a correct lifecycle phase to add new child components?

2011-09-07 Thread Alex Harui
Yes, it is a set of trade-offs.  Deferring until you know you need it is best 
for memory and startup time, but you have to pay for the adding later.  You can 
cache the button so you don’t always create a new one.  You can even share a 
button between all renderers if you want.


On 9/7/11 5:42 AM, ganaraj p r ganara...@gmail.com wrote:






With toggling the visibility property you are creating 1 Button per Item 
Renderer.

When you are creating an object each time a user's mouse is over it, and then 
deleting it when its out, you are creating 'n' number of objects and deleting 
them , the new objects need to be garbage collected.

The initial load is going to be more ofcourse, but then its a set number since 
you are only going to be creating a set number of buttons.

On Wed, Sep 7, 2011 at 10:23 AM, Nick Middleweek n...@middleweek.co.uk wrote:





Alex,

Just checking/ thinking... But if I go down the visibility route and addChild( 
x ) up front in createChildren() would I be consuming more initial memory than 
if I addChild( x ) as and when I needed it?

In my case, I have 15 columns, using the same renderer and 40 rows so that's 
600 extra buttons that would be created that are initially set visible = false;

I'm assuming they are all in memory and when scrolling, this could impact 
scroll performance.


Or is adding/ removing children dynamically and making each Item Renderer go 
through it's update cycle more expensive?


Cheers,
Nick




On 6 September 2011 19:48, Alex Harui aha...@adobe.com wrote:





States are still available in the MX way.  You can also hide and show instead 
of add and remove.

Known children should be created in createChildren or in states.  But 
otherwise, you have to create them when you know you need them.  The List 
components create them in updateDisplayList since that’s when they finally know 
how many to create.



On 9/6/11 10:48 AM, Nick Middleweek n...@middleweek.co.uk 
http://n...@middleweek.co.uk  wrote:






Thanks for this... So I'm extending UIComponent, does this mean I'm doing it 
the MX way?

Cheers...


On 6 September 2011 14:38, Haykel BEN JEMIA hayke...@gmail.com 
http://hayke...@gmail.com  wrote:





Hi Nick,

if you use Spark components and the child components you want to add are fixed 
and known, e.g. a 'close' button that should be visible on mouse-over, then I 
would use skin states and manage visibility of the components in the skin.

Haykel Ben Jemia

Allmas
Web  RIA Development
http://www.allmas-tn.com





On Tue, Sep 6, 2011 at 10:28 AM, Nick Middleweek n...@middleweek.co.uk 
http://n...@middleweek.co.uk  wrote:





Hi,

I've been trying to find the correct 'place' to create new components after the 
parent component is UPDATE_COMPLETE.

During initialisation, we create child components in createChildren() but 
where/ when should we create them for e.g. in response to a mouseOver or a 
mouseClick event?

Is it simply 'ok' to this.addChild( myNewButton ) in a MOUSE_EVENT function 
handler or should I be setting some dirty flag to trigger off an invalidation 
and then add the button in a lifecycle override function?


Thanks,
Nick


--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui


Re: [flexcoders] What is the a correct lifecycle phase to add new child components?

2011-09-07 Thread Nick Middleweek
Alex,

That's a good idea... What's your thoughts on approach to implement a shared
Button?

Would you create it at the parent view level and inject into the IR's using
some kind of IFactory or perhaps attach it to the data property?


Cheers,
Nick



On 7 September 2011 17:27, Alex Harui aha...@adobe.com wrote:

 **


 Yes, it is a set of trade-offs.  Deferring until you know you need it is
 best for memory and startup time, but you have to pay for the adding later.
  You can cache the button so you don’t always create a new one.  You can
 even share a button between all renderers if you want.



 On 9/7/11 5:42 AM, ganaraj p r ganara...@gmail.com wrote:






 With toggling the visibility property you are creating 1 Button per Item
 Renderer.

 When you are creating an object each time a user's mouse is over it, and
 then deleting it when its out, you are creating 'n' number of objects and
 deleting them , the new objects need to be garbage collected.

 The initial load is going to be more ofcourse, but then its a set number
 since you are only going to be creating a set number of buttons.

 On Wed, Sep 7, 2011 at 10:23 AM, Nick Middleweek n...@middleweek.co.uk
 wrote:






 Alex,

 Just checking/ thinking... But if I go down the visibility route and
 addChild( x ) up front in createChildren() would I be consuming more initial
 memory than if I addChild( x ) as and when I needed it?

 In my case, I have 15 columns, using the same renderer and 40 rows so
 that's 600 extra buttons that would be created that are initially set
 visible = false;

 I'm assuming they are all in memory and when scrolling, this could impact
 scroll performance.


 Or is adding/ removing children dynamically and making each Item Renderer
 go through it's update cycle more expensive?


 Cheers,
 Nick




 On 6 September 2011 19:48, Alex Harui aha...@adobe.com wrote:






 States are still available in the MX way.  You can also hide and show
 instead of add and remove.

 Known children should be created in createChildren or in states.  But
 otherwise, you have to create them when you know you need them.  The List
 components create them in updateDisplayList since that’s when they finally
 know how many to create.



 On 9/6/11 10:48 AM, Nick Middleweek n...@middleweek.co.uk 
 http://n...@middleweek.co.uk  wrote:






 Thanks for this... So I'm extending UIComponent, does this mean I'm doing
 it the MX way?

 Cheers...


 On 6 September 2011 14:38, Haykel BEN JEMIA hayke...@gmail.com 
 http://hayke...@gmail.com  wrote:






 Hi Nick,

 if you use Spark components and the child components you want to add are
 fixed and known, e.g. a 'close' button that should be visible on mouse-over,
 then I would use skin states and manage visibility of the components in the
 skin.

 Haykel Ben Jemia

 Allmas
 Web  RIA Development
 http://www.allmas-tn.com





 On Tue, Sep 6, 2011 at 10:28 AM, Nick Middleweek n...@middleweek.co.uk 
 http://n...@middleweek.co.uk  wrote:






 Hi,

 I've been trying to find the correct 'place' to create new components after
 the parent component is UPDATE_COMPLETE.

 During initialisation, we create child components in *createChildren()*but 
 where/ when should we create them for e.g. in response to a mouseOver or
 a mouseClick event?

 Is it simply 'ok' to *this.addChild( *myNewButton *)* in a MOUSE_EVENT
 function handler or should I be setting some dirty flag to trigger off an
 invalidation and then add the button in a lifecycle override function?


 Thanks,
 Nick


 --
 Alex Harui
 Flex SDK Team
 Adobe System, Inc.
 http://blogs.adobe.com/aharui

  




-- 
Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774
035 5424, blog: http://www.middleweek.co.uk } );


Re: [flexcoders] What is the a correct lifecycle phase to add new child components?

2011-09-07 Thread Douglas Knudsen
also keep in mind virtualization use in Lists.  Just one more cog in The
Wheel That Depends

Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it?


On Wed, Sep 7, 2011 at 3:21 PM, Nick Middleweek n...@middleweek.co.ukwrote:

 **


 Alex,

 That's a good idea... What's your thoughts on approach to implement a
 shared Button?

 Would you create it at the parent view level and inject into the IR's using
 some kind of IFactory or perhaps attach it to the data property?


 Cheers,
 Nick



 On 7 September 2011 17:27, Alex Harui aha...@adobe.com wrote:

 **


 Yes, it is a set of trade-offs.  Deferring until you know you need it is
 best for memory and startup time, but you have to pay for the adding later.
  You can cache the button so you don’t always create a new one.  You can
 even share a button between all renderers if you want.



 On 9/7/11 5:42 AM, ganaraj p r ganara...@gmail.com wrote:






 With toggling the visibility property you are creating 1 Button per Item
 Renderer.

 When you are creating an object each time a user's mouse is over it, and
 then deleting it when its out, you are creating 'n' number of objects and
 deleting them , the new objects need to be garbage collected.

 The initial load is going to be more ofcourse, but then its a set number
 since you are only going to be creating a set number of buttons.

 On Wed, Sep 7, 2011 at 10:23 AM, Nick Middleweek n...@middleweek.co.uk
 wrote:






 Alex,

 Just checking/ thinking... But if I go down the visibility route and
 addChild( x ) up front in createChildren() would I be consuming more initial
 memory than if I addChild( x ) as and when I needed it?

 In my case, I have 15 columns, using the same renderer and 40 rows so
 that's 600 extra buttons that would be created that are initially set
 visible = false;

 I'm assuming they are all in memory and when scrolling, this could impact
 scroll performance.


 Or is adding/ removing children dynamically and making each Item Renderer
 go through it's update cycle more expensive?


 Cheers,
 Nick




 On 6 September 2011 19:48, Alex Harui aha...@adobe.com wrote:






 States are still available in the MX way.  You can also hide and show
 instead of add and remove.

 Known children should be created in createChildren or in states.  But
 otherwise, you have to create them when you know you need them.  The List
 components create them in updateDisplayList since that’s when they finally
 know how many to create.



 On 9/6/11 10:48 AM, Nick Middleweek n...@middleweek.co.uk 
 http://n...@middleweek.co.uk  wrote:






 Thanks for this... So I'm extending UIComponent, does this mean I'm doing
 it the MX way?

 Cheers...


 On 6 September 2011 14:38, Haykel BEN JEMIA hayke...@gmail.com 
 http://hayke...@gmail.com  wrote:






 Hi Nick,

 if you use Spark components and the child components you want to add are
 fixed and known, e.g. a 'close' button that should be visible on mouse-over,
 then I would use skin states and manage visibility of the components in the
 skin.

 Haykel Ben Jemia

 Allmas
 Web  RIA Development
 http://www.allmas-tn.com





 On Tue, Sep 6, 2011 at 10:28 AM, Nick Middleweek n...@middleweek.co.uk 
 http://n...@middleweek.co.uk  wrote:






 Hi,

 I've been trying to find the correct 'place' to create new components
 after the parent component is UPDATE_COMPLETE.

 During initialisation, we create child components in *createChildren()*but 
 where/ when should we create them for e.g. in response to a mouseOver or
 a mouseClick event?

 Is it simply 'ok' to *this.addChild( *myNewButton *)* in a MOUSE_EVENT
 function handler or should I be setting some dirty flag to trigger off an
 invalidation and then add the button in a lifecycle override function?


 Thanks,
 Nick


 --
 Alex Harui
 Flex SDK Team
 Adobe System, Inc.
 http://blogs.adobe.com/aharui




 --
 Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774
 035 5424, blog: http://www.middleweek.co.uk } );


  



Re: [flexcoders] What is the a correct lifecycle phase to add new child components?

2011-09-07 Thread Alex Harui
I think I’d just hack it in.  You can probably hang it off of the DG when not 
used and grab it from there when needed.  The parent of the blue focus 
rectangle is shared among all Flex components in an app.


On 9/7/11 12:21 PM, Nick Middleweek n...@middleweek.co.uk wrote:






Alex,

That's a good idea... What's your thoughts on approach to implement a shared 
Button?

Would you create it at the parent view level and inject into the IR's using 
some kind of IFactory or perhaps attach it to the data property?


Cheers,
Nick



On 7 September 2011 17:27, Alex Harui aha...@adobe.com wrote:





Yes, it is a set of trade-offs.  Deferring until you know you need it is best 
for memory and startup time, but you have to pay for the adding later.  You can 
cache the button so you don’t always create a new one.  You can even share a 
button between all renderers if you want.




On 9/7/11 5:42 AM, ganaraj p r ganara...@gmail.com 
http://ganara...@gmail.com  wrote:






With toggling the visibility property you are creating 1 Button per Item 
Renderer.

When you are creating an object each time a user's mouse is over it, and then 
deleting it when its out, you are creating 'n' number of objects and deleting 
them , the new objects need to be garbage collected.

The initial load is going to be more ofcourse, but then its a set number since 
you are only going to be creating a set number of buttons.

On Wed, Sep 7, 2011 at 10:23 AM, Nick Middleweek n...@middleweek.co.uk 
http://n...@middleweek.co.uk  wrote:





Alex,

Just checking/ thinking... But if I go down the visibility route and addChild( 
x ) up front in createChildren() would I be consuming more initial memory than 
if I addChild( x ) as and when I needed it?

In my case, I have 15 columns, using the same renderer and 40 rows so that's 
600 extra buttons that would be created that are initially set visible = false;

I'm assuming they are all in memory and when scrolling, this could impact 
scroll performance.


Or is adding/ removing children dynamically and making each Item Renderer go 
through it's update cycle more expensive?


Cheers,
Nick




On 6 September 2011 19:48, Alex Harui aha...@adobe.com 
http://aha...@adobe.com  wrote:





States are still available in the MX way.  You can also hide and show instead 
of add and remove.

Known children should be created in createChildren or in states.  But 
otherwise, you have to create them when you know you need them.  The List 
components create them in updateDisplayList since that’s when they finally know 
how many to create.



On 9/6/11 10:48 AM, Nick Middleweek n...@middleweek.co.uk 
http://n...@middleweek.co.uk  http://n...@middleweek.co.uk  wrote:






Thanks for this... So I'm extending UIComponent, does this mean I'm doing it 
the MX way?

Cheers...


On 6 September 2011 14:38, Haykel BEN JEMIA hayke...@gmail.com 
http://hayke...@gmail.com  http://hayke...@gmail.com  wrote:





Hi Nick,

if you use Spark components and the child components you want to add are fixed 
and known, e.g. a 'close' button that should be visible on mouse-over, then I 
would use skin states and manage visibility of the components in the skin.

Haykel Ben Jemia

Allmas
Web  RIA Development
http://www.allmas-tn.com





On Tue, Sep 6, 2011 at 10:28 AM, Nick Middleweek n...@middleweek.co.uk 
http://n...@middleweek.co.uk  http://n...@middleweek.co.uk  wrote:





Hi,

I've been trying to find the correct 'place' to create new components after the 
parent component is UPDATE_COMPLETE.

During initialisation, we create child components in createChildren() but 
where/ when should we create them for e.g. in response to a mouseOver or a 
mouseClick event?

Is it simply 'ok' to this.addChild( myNewButton ) in a MOUSE_EVENT function 
handler or should I be setting some dirty flag to trigger off an invalidation 
and then add the button in a lifecycle override function?


Thanks,
Nick


--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui


Re: [flexcoders] What is the a correct lifecycle phase to add new child components?

2011-09-06 Thread Jeffry Houser


 I hav used commitProperties() in the past. Although some people will 
use commitProperties to call createChildren() if new children are needed 
to be created.


 However, I'd be cautious about creating children based on the 
update_complete event.  It seems like an unnecessary way to force yet 
another full render of the component..


On 9/6/2011 5:28 AM, Nick Middleweek wrote:

Hi,

I've been trying to find the correct 'place' to create new components 
after the parent component is UPDATE_COMPLETE.


During initialisation, we create child components in 
*createChildren()* but where/ when should we create them for e.g. in 
response to a mouseOver or a mouseClick event?


Is it simply 'ok' to *this.addChild( *myNewButton *)* in a MOUSE_EVENT 
function handler or should I be setting some dirty flag to trigger off 
an invalidation and then add the button in a lifecycle override function?



Thanks,
Nick


--
Sent by Nick Middleweek ( { email: n...@middleweek.co.uk 
mailto:n...@middleweek.co.uk, mobile: +44(0)774 035 5424 } );







--
Jeffry Houser
Technical Entrepreneur
203-379-0773
--
http://www.flextras.com?c=104
UI Flex Components: Tested! Supported! Ready!
--
http://www.theflexshow.com
http://www.jeffryhouser.com
http://www.asktheflexpert.com
--
Part of the DotComIt Brain Trust



Re: [flexcoders] What is the a correct lifecycle phase to add new child components?

2011-09-06 Thread Haykel BEN JEMIA
Hi Nick,

if you use Spark components and the child components you want to add are
fixed and known, e.g. a 'close' button that should be visible on mouse-over,
then I would use skin states and manage visibility of the components in the
skin.

Haykel Ben Jemia

Allmas
Web  RIA Development
http://www.allmas-tn.com




On Tue, Sep 6, 2011 at 10:28 AM, Nick Middleweek n...@middleweek.co.ukwrote:

 **


 Hi,

 I've been trying to find the correct 'place' to create new components after
 the parent component is UPDATE_COMPLETE.

 During initialisation, we create child components in *createChildren()*but 
 where/ when should we create them for e.g. in response to a mouseOver or
 a mouseClick event?

 Is it simply 'ok' to *this.addChild( *myNewButton *)* in a MOUSE_EVENT
 function handler or should I be setting some dirty flag to trigger off an
 invalidation and then add the button in a lifecycle override function?


 Thanks,
 Nick


 --
 Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774
 035 5424 } );


  



Re: [flexcoders] What is the a correct lifecycle phase to add new child components?

2011-09-06 Thread Nick Middleweek
Hi Jeff,

The component I'm working on is an Item Renderer for an Advanced Data Grid.

I'm currently creating the button on onMouseOver() and then removing the
button on onMouseOut().

commitProperties() doesn't come into play unless I guess, I set a flag on a
setter and then call invalidateProperties() from the setter but would that
make any real difference? I mean, is it the same calling addChild(myButton)
from onMouseOver() function handler or from within commitProperties?

Does anything naturally happen (life cycle wise) after commitProperties() is
invoked?


Thanks,
Nick



On 6 September 2011 13:09, Jeffry Houser jef...@dot-com-it.com wrote:

 **



  I hav used commitProperties() in the past. Although some people will use
 commitProperties to call createChildren() if new children are needed to be
 created.

  However, I'd be cautious about creating children based on the
 update_complete event.  It seems like an unnecessary way to force yet
 another full render of the component..

 On 9/6/2011 5:28 AM, Nick Middleweek wrote:


 Hi,

  I've been trying to find the correct 'place' to create new components
 after the parent component is UPDATE_COMPLETE.

  During initialisation, we create child components in *createChildren()*but 
 where/ when should we create them for e.g. in response to a mouseOver or
 a mouseClick event?

  Is it simply 'ok' to *this.addChild( *myNewButton *)* in a MOUSE_EVENT
 function handler or should I be setting some dirty flag to trigger off an
 invalidation and then add the button in a lifecycle override function?


  Thanks,
 Nick


  --
 Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774
 035 5424 } );




 --
 Jeffry Houser
 Technical Entrepreneur203-379-0773
 --http://www.flextras.com?c=104
 UI Flex Components: Tested! Supported! Ready!
 --http://www.theflexshow.comhttp://www.jeffryhouser.comhttp://www.asktheflexpert.com
 --
 Part of the DotComIt Brain Trust

  




-- 
Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774
035 5424, blog: http://www.middleweek.co.uk } );


Re: [flexcoders] What is the a correct lifecycle phase to add new child components?

2011-09-06 Thread Nick Middleweek
Thanks for this... So I'm extending UIComponent, does this mean I'm doing it
the MX way?

Cheers...


On 6 September 2011 14:38, Haykel BEN JEMIA hayke...@gmail.com wrote:

 **


 Hi Nick,

 if you use Spark components and the child components you want to add are
 fixed and known, e.g. a 'close' button that should be visible on mouse-over,
 then I would use skin states and manage visibility of the components in the
 skin.

 Haykel Ben Jemia

 Allmas
 Web  RIA Development
 http://www.allmas-tn.com





 On Tue, Sep 6, 2011 at 10:28 AM, Nick Middleweek n...@middleweek.co.ukwrote:

 **


 Hi,

 I've been trying to find the correct 'place' to create new components
 after the parent component is UPDATE_COMPLETE.

 During initialisation, we create child components in *createChildren()*but 
 where/ when should we create them for e.g. in response to a mouseOver or
 a mouseClick event?

 Is it simply 'ok' to *this.addChild( *myNewButton *)* in a MOUSE_EVENT
 function handler or should I be setting some dirty flag to trigger off an
 invalidation and then add the button in a lifecycle override function?


 Thanks,
 Nick


 --
 Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774
 035 5424 } );



  




-- 
Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774
035 5424, blog: http://www.middleweek.co.uk } );


Re: [flexcoders] What is the a correct lifecycle phase to add new child components?

2011-09-06 Thread Haykel BEN JEMIA
Yes. To take advantage of the spark architecture you have to extend
SkinnableComponent (or one of the other SkinnableXXX classes, depending on
your needs).

Example: Creating a skinnable Spark component
http://help.adobe.com/en_US/flex/using/WS460ee381960520ad-2811830c121e9107ecb-7feb.html

Haykel Ben Jemia

Allmas
Web  RIA Development
http://www.allmas-tn.com




On Tue, Sep 6, 2011 at 6:48 PM, Nick Middleweek n...@middleweek.co.ukwrote:

 **


 Thanks for this... So I'm extending UIComponent, does this mean I'm doing
 it the MX way?

 Cheers...


 On 6 September 2011 14:38, Haykel BEN JEMIA hayke...@gmail.com wrote:

 **


 Hi Nick,

 if you use Spark components and the child components you want to add are
 fixed and known, e.g. a 'close' button that should be visible on mouse-over,
 then I would use skin states and manage visibility of the components in the
 skin.

 Haykel Ben Jemia

 Allmas
 Web  RIA Development
 http://www.allmas-tn.com





 On Tue, Sep 6, 2011 at 10:28 AM, Nick Middleweek 
 n...@middleweek.co.ukwrote:

 **


 Hi,

 I've been trying to find the correct 'place' to create new components
 after the parent component is UPDATE_COMPLETE.

 During initialisation, we create child components in *createChildren()*but 
 where/ when should we create them for e.g. in response to a mouseOver or
 a mouseClick event?

 Is it simply 'ok' to *this.addChild( *myNewButton *)* in a MOUSE_EVENT
 function handler or should I be setting some dirty flag to trigger off an
 invalidation and then add the button in a lifecycle override function?


 Thanks,
 Nick


 --
 Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774
 035 5424 } );






 --
 Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774
 035 5424, blog: http://www.middleweek.co.uk } );


  



Re: [flexcoders] What is the a correct lifecycle phase to add new child components?

2011-09-06 Thread Alex Harui
States are still available in the MX way.  You can also hide and show instead 
of add and remove.

Known children should be created in createChildren or in states.  But 
otherwise, you have to create them when you know you need them.  The List 
components create them in updateDisplayList since that’s when they finally know 
how many to create.

On 9/6/11 10:48 AM, Nick Middleweek n...@middleweek.co.uk wrote:






Thanks for this... So I'm extending UIComponent, does this mean I'm doing it 
the MX way?

Cheers...


On 6 September 2011 14:38, Haykel BEN JEMIA hayke...@gmail.com wrote:





Hi Nick,

if you use Spark components and the child components you want to add are fixed 
and known, e.g. a 'close' button that should be visible on mouse-over, then I 
would use skin states and manage visibility of the components in the skin.

Haykel Ben Jemia

Allmas
Web  RIA Development
http://www.allmas-tn.com





On Tue, Sep 6, 2011 at 10:28 AM, Nick Middleweek n...@middleweek.co.uk wrote:





Hi,

I've been trying to find the correct 'place' to create new components after the 
parent component is UPDATE_COMPLETE.

During initialisation, we create child components in createChildren() but 
where/ when should we create them for e.g. in response to a mouseOver or a 
mouseClick event?

Is it simply 'ok' to this.addChild( myNewButton ) in a MOUSE_EVENT function 
handler or should I be setting some dirty flag to trigger off an invalidation 
and then add the button in a lifecycle override function?


Thanks,
Nick


--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui


Re: [flexcoders] What is the a correct lifecycle phase to add new child components?

2011-09-06 Thread Douglas Knudsen
ze MX way, yes.  So, um, I suggest you look at the visible property.  Adding
the child once in createChildren() then managing the visible property sounds
better in the long run. If you really must add/remove the button, I'd say
use updateDisplayList(), a good place for adding/removing dynamic children.

There's a crap ton of info on the life cycle, here is one such source
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf68641-7ff0.html


Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it?


On Tue, Sep 6, 2011 at 1:47 PM, Nick Middleweek n...@middleweek.co.ukwrote:

 **


 Hi Jeff,

 The component I'm working on is an Item Renderer for an Advanced Data Grid.

 I'm currently creating the button on onMouseOver() and then removing the
 button on onMouseOut().

 commitProperties() doesn't come into play unless I guess, I set a flag on a
 setter and then call invalidateProperties() from the setter but would that
 make any real difference? I mean, is it the same calling addChild(myButton)
 from onMouseOver() function handler or from within commitProperties?

 Does anything naturally happen (life cycle wise) after commitProperties()
 is invoked?


 Thanks,
 Nick



 On 6 September 2011 13:09, Jeffry Houser jef...@dot-com-it.com wrote:

 **



  I hav used commitProperties() in the past. Although some people will use
 commitProperties to call createChildren() if new children are needed to be
 created.

  However, I'd be cautious about creating children based on the
 update_complete event.  It seems like an unnecessary way to force yet
 another full render of the component..

 On 9/6/2011 5:28 AM, Nick Middleweek wrote:


 Hi,

  I've been trying to find the correct 'place' to create new components
 after the parent component is UPDATE_COMPLETE.

  During initialisation, we create child components in *createChildren()*but 
 where/ when should we create them for e.g. in response to a mouseOver or
 a mouseClick event?

  Is it simply 'ok' to *this.addChild( *myNewButton *)* in a MOUSE_EVENT
 function handler or should I be setting some dirty flag to trigger off an
 invalidation and then add the button in a lifecycle override function?


  Thanks,
 Nick


  --
 Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774
 035 5424 } );




 --
 Jeffry Houser
 Technical Entrepreneur203-379-0773
 --http://www.flextras.com?c=104
 UI Flex Components: Tested! Supported! Ready!
 --http://www.theflexshow.comhttp://www.jeffryhouser.comhttp://www.asktheflexpert.com
 --
 Part of the DotComIt Brain Trust




 --
 Sent by Nick Middleweek ( { email: n...@middleweek.co.uk, mobile: +44(0)774
 035 5424, blog: http://www.middleweek.co.uk } );