Concerning Manish example, what is the magic numbers there?
>> _measuredPreferredHeight = label.textHeight + 4;
And it doesn't work!
 
I will try "getTextExtent" workaround.
 
Best regards
Stanislav

 
On 6/14/06, Andriy Panas <[EMAIL PROTECTED]> wrote:
Hello Stanislav,

One more idea found by me at history of the Flexcoders mailing list
is to use TextFormat.getTextExtent () function to calculate the size of the text:
http://livedocs.macromedia.com/flash/mx2004/main_7_2/00001840.html#40

Example:
------------------------------------------
var txtFmt:TextFormat=new TextFormat();
txtFmt.font=this.getStyle("fontFamily");
var labelMetrics:Object=txtFmt.getTextExtent(code);
var initObj:Object=new Object();
initObj.x=Math.floor(this.width/2)-Math.floor(labelMetrics.textFieldWidth/2);
initObj.y=this.height-(this.getStyle("fontSize")+margin);
initObj.text=code;
this.createChild(mx.controls.Label,"",initObj);
------------------------------------------


--
Best regards,
Andriy                            mailto:[EMAIL PROTECTED]



------------------------ Yahoo! Groups Sponsor --------------------~-->
Home is just a click away. Make Yahoo! your home page now.
http://us.click.yahoo.com/DHchtC/3FxNAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->

--
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

<*> To visit your group on the web, go to:
   http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
   [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
   http://docs.yahoo.com/info/terms/




__._,_.___

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





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to