PDA

View Full Version : How to change dynamic text height in a menu



zik80
August 19th, 2009, 09:29 PM
I have a menu like the one here (http://tutorials.flashmymind.com/2009/04/vertical-menu-with-actionscript-3-and-xml/). I need some of the menus to be 2 lines and others single line.

Basically, the menu is set to use dynamic text with multiple lines and word wrap inside a movie clip. So far, I can either get it to do single or double lines of menu, but not both. Could someone please help on how to do that? Thanks.

shubs6
August 20th, 2009, 12:26 AM
Which component are you using?
You can use property "variableRowHeight" alongwith "wordwrap/multiline" to achieve your purpose.
I dunno your comonent but this may help you
http://www.sys-con.com/node/1006218

zik80
August 20th, 2009, 12:58 PM
shubs6, I am using Flash CS3 and not Flex. The component used is a text box inside a movie clip.

myoreo
August 20th, 2009, 02:46 PM
this worked for me in the past:

set your dynamic text movieclip so the height is for one line of text. Make sure to embed fonts. (property window)

then in the actionscript,
_txtMc.wordWrap = false;
_txtMc.multiline = true;
_txtMc.antiAliasType = AntiAliasType.ADVANCED;
_txtMc.autoSize = TextFieldAutoSize.LEFT;

hope that helps

zik80
August 20th, 2009, 06:00 PM
Thanks so much, myoreo. You've pointed me in the right direction. I had applied similar formats before, which resulted in jumbled lines in some part of the menu. When your code produced the same effect, I realized that I wasn't updating the menu holder height to include the non-regular height menu. With that taken care of, it works fine. Kudos!