Re: [flexcoders] Custom UIComponent creating problem

2006-08-15 Thread Michael Schmalle



Gordon;Opps my bad; to early in the morning;I read to much into this,He needed
	item_button.label = "As";override protected function updateDisplayList({   super.updateD ...   item_button.move(0, 0);   item_button.setActualSize( item_button.measuredWidth, item_button.measuredHeight);
Heh, sorry about that but, what I said still does pertain to the border. ;-)Peace, MikeOn 8/15/06, Gordon Smith <
[EMAIL PROTECTED]> wrote:












  













A general rule in Flex layout management is
that children get positioned and sized by their parents. I suspect that the
reason you don't see anything is that item_button has a width and height of 0
by default.

 

If you extend UIComponent, then it is your
responsibility to position and size all of your component's children (in this
case, item_button) in an override of updateDisplayList().

 

When you extend HBox, HBox's override of
updateDisplayList() implements the horizontal box layout algorithm for the
children.

 

- Gordon

 









From: [EMAIL PROTECTED]
ups.com [mailto:[EMAIL PROTECTED]
ups.com] On Behalf Of sinacapho
Sent: Tuesday, August 15, 2006
1:18 AM
To: [EMAIL PROTECTED]ups.com
Subject: [flexcoders] Custom
UIComponent creating problem



 







Dear all, 
i have the followig problem , i have using AS3 to created a
custom component (extends from UIComponent) , i find that the custom
component cannot display on the screen. But if the component extends
from HBox , it will show correctly . Can someone tell me why?
The code is attached.

thx
capho

// Mxml


http://www.adobe.com/2006/mxml"
xmlns:gp="test_comp.*">





// ActionScript file

package test_comp{

import mx.core.UIComponent;
import mx.controls.Button;
import mx.containers.HBox;

public class test_item extends HBox{

private var item_button:Button;

public function test_item(){
super(); 
}

override protected function createChildren():void {

super.createChildren();

if (!item_button){
item_button = new Button();
item_button.label = "As";
addChild(item_button); 
}

}

override protected function measure():void{
super.measure();
measuredWidth = measuredMinWidth = 410;
measuredHeight = measuredMinHeight = 30;
}


}
}










  













-- What goes up, does come down.

__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   



  




  
  
  YAHOO! GROUPS LINKS



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



RE: [flexcoders] Custom UIComponent creating problem

2006-08-15 Thread Gordon Smith












A general rule in Flex layout management is
that children get positioned and sized by their parents. I suspect that the
reason you don't see anything is that item_button has a width and height of 0
by default.

 

If you extend UIComponent, then it is your
responsibility to position and size all of your component's children (in this
case, item_button) in an override of updateDisplayList().

 

When you extend HBox, HBox's override of
updateDisplayList() implements the horizontal box layout algorithm for the
children.

 

- Gordon

 









From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of sinacapho
Sent: Tuesday, August 15, 2006
1:18 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Custom
UIComponent creating problem



 







Dear all, 
i have the followig problem , i have using AS3 to created a
custom component (extends from UIComponent) , i find that the custom
component cannot display on the screen. But if the component extends
from HBox , it will show correctly . Can someone tell me why?
The code is attached.

thx
capho

// Mxml

8"?>
http://www.adobe.com/2006/mxml"
xmlns:gp="test_comp.*">

>



// ActionScript file

package test_comp{

import mx.core.UIComponent;
import mx.controls.Button;
import mx.containers.HBox;

public class test_item extends HBox{

private var item_button:Button;

public function test_item(){
super(); 
}

override protected function createChildren():void {

super.createChildren();

if (!item_button){
item_button = new Button();
item_button.label = "As";
addChild(item_button); 
}

}

override protected function measure():void{
super.measure();
measuredWidth = measuredMinWidth = 410;
measuredHeight = measuredMinHeight = 30;
}


}
}






__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   



  




  
  
  YAHOO! GROUPS LINKS



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___