[flexcoders] This has to be a bug right? If not, please explain...

2007-11-27 Thread Justin Winter
added to a creationComplete handler function:

code
var vBox:VBox = new VBox();

for(var i:int = 0; i  10; i++)
{
var tmpBtn:Button = new Button();
tmpBtn.label = BUTTON:  + i;
vBox.addChild(tmpBtn);  
}

this.addChild(vBox);

trace('VBOX HEIGHT: ' + vBox.height);
/code

OUTPUT:
--
VBOX HEIGHT: 0 - ALWAYS ZERO

No matter if I call vBox.invalidateProperties(); or any of the other
invalidate functions. The buttons are added to the container fine and
are displayed fine. 

I've also tried this with several other containers and the height is
not updated after the children are added. What am I missing here? 



RE: [flexcoders] This has to be a bug right? If not, please explain...

2007-11-27 Thread Alex Harui
Flex uses an invalidation mechanism.  As properties change, flags are
set requesting validation of those properties at a later time.  You can
force validation by calling validateNow(), but it can be expensive.



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Justin Winter
Sent: Tuesday, November 27, 2007 9:10 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] This has to be a bug right? If not, please
explain...



added to a creationComplete handler function:

code
var vBox:VBox = new VBox();

for(var i:int = 0; i  10; i++)
{
var tmpBtn:Button = new Button();
tmpBtn.label = BUTTON:  + i;
vBox.addChild(tmpBtn); 
}

this.addChild(vBox);

trace('VBOX HEIGHT: ' + vBox.height);
/code

OUTPUT:
--
VBOX HEIGHT: 0 - ALWAYS ZERO

No matter if I call vBox.invalidateProperties(); or any of the other
invalidate functions. The buttons are added to the container fine and
are displayed fine. 

I've also tried this with several other containers and the height is
not updated after the children are added. What am I missing here? 



 


RE: [flexcoders] This has to be a bug right? If not, please explain...

2007-11-27 Thread Tracy Spratt
For creating multiples of the same component, consider using
mx:Repeater.  It handles many ugly details for you.  If, for example,
you wanted to remove the children you created using addChild, it would
take some thought and some code, further complicated if there are static
components in the container as well.  With Repeater, just do:
myRepeater.dataProvider.removeAll();

Tracy

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Alex Harui
Sent: Tuesday, November 27, 2007 12:14 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] This has to be a bug right? If not, please
explain...

 

Flex uses an invalidation mechanism.  As properties change, flags are
set requesting validation of those properties at a later time.  You can
force validation by calling validateNow(), but it can be expensive.

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Justin Winter
Sent: Tuesday, November 27, 2007 9:10 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] This has to be a bug right? If not, please
explain...

added to a creationComplete handler function:

code
var vBox:VBox = new VBox();

for(var i:int = 0; i  10; i++)
{
var tmpBtn:Button = new Button();
tmpBtn.label = BUTTON:  + i;
vBox.addChild(tmpBtn); 
}

this.addChild(vBox);

trace('VBOX HEIGHT: ' + vBox.height);
/code

OUTPUT:
--
VBOX HEIGHT: 0 - ALWAYS ZERO

No matter if I call vBox.invalidateProperties(); or any of the other
invalidate functions. The buttons are added to the container fine and
are displayed fine. 

I've also tried this with several other containers and the height is
not updated after the children are added. What am I missing here?