A few things:
You'll need to override measure(), like so:
protected override function measure() : void {
measuredWidth = _txt.measuredWidth;
measuredHeight = _txt.measuredHeight;
}
and updateDisplayList(), like so:
protected override function updateDisplayList(w:Number, h:Number) : void {
_txt.move(0,0);
_txt.setActualSize(Math.min(_txt.measuredWidth, w),
Math.min(_txt.measuredHeight, h));
}
That should do it. But this is typed in gmail, not Flex so it's probably got
typos in it :)
-Josh
On Mon, Jun 30, 2008 at 9:50 AM, flexawesome <[EMAIL PROTECTED]> wrote:
>
> Hey there,
>
> I was trying to create a very simple component in as, there was no error
> in compiling. However, I was unable to see the text. :( can you take a
> quick look? thank you
>
> =================== AS ====================
>
> package
> {
> import mx.controls.Text;
> import mx.core.UIComponent;
>
> public class Footer extends UIComponent
> {
> public var title:String;
> private var _txt:Text;
>
> public function Footer()
> {
> super.setActualSize(50 , 20 );
>
> _txt= new Text();
> _txt.text = title;
> addChild( _txt );
> }
> }
> }
>
> ============ in main.mxml ===========
>
> <local:newText title="asdfasdfa" />
>
>
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
> Links
>
>
>
>
--
"Therefore, send not to know For whom the bell tolls. It tolls for thee."
:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]