Step through the code.
Will the labels height and width have any values at the time
createChildren runs?
Additionally you may need to set the width and height of 'this'.
Additionally, isn't the measure method supposed o set the measuredWidth
and measuredHeight values of your component? In the sample you specify
it does not.
j2me_soul wrote:
*Why the label can't be displaied on the srceen?*
public class rectElement extends UIComponent
{
private var lal:Label;
public function rectElement()
{
super();
}
override protected function createChildren():void{
if( lal == null ){
lal = new Label;
lal.text = "Label";
addChild(lal);
this.explicitWidth = lal.width;
this.explicitHeight = lal.height;
}
}
override protected function measure():void{
this.explicitMinWidth = this.explicitMinHeight = 50;
}
}
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" mlns:local="*">
<local:rectElement >
/* there is nothing on the screen. Where is the Label ? */
</local:rectElement>
</mx:Application>
------------------------------------------------------------------------
???????????????????????? <http://qiye.163.com/?ft=3>
--
Jeffry Houser, Technical Entrepreneur
Adobe Community Expert: http://tinyurl.com/684b5h
http://www.twitter.com/reboog711 | Phone: 203-379-0773
--
Easy to use Interface Components for Flex Developers
http://www.flextras.com?c=104
--
http://www.theflexshow.com
http://www.jeffryhouser.com
--
Part of the DotComIt Brain Trust