all groups > flash actionscript > december 2006 >
You're in the

flash actionscript

group:

Re: having problem with textHeight


Re: having problem with textHeight rohai
12/18/2006 10:19:53 PM
flash actionscript:
kglad, thx for your suggestion. I did put the _y position line right after the
line, where a assign the title attribute to a text field. But now there's a new
problem. The first two item are in right position and the distance between them
is also right. But then the distance between the third and foutrh is smaller
and between the fourth and fifth is even smaller. And the distance between the
second and third item is huge. Any ideas
Re: having problem with textHeight kglad
12/18/2006 10:58:16 PM
usually one would position the textfields based on the previous textfields
position and height. something like:



GenerateMenu = function (holder, name, x, y, depth, node_xml) {
var curr_node;
var curr_item;
var curr_menu = holder.createEmptyMovieClip(name, depth);
prevY = 0;
prevH = 0;
for (var i = 0; i<node_xml.childNodes.length; i++) {
// movieclip for each menu item
curr_item = curr_menu.attachMovie("menuitem", "item"+i+"_mc", i);
curr_item._y = prevY+prevH;
curr_item._x = x;
curr_item.trackAsMenu = true;
curr_node = node_xml.childNodes[i];
curr_item.tf.text = curr_node.attributes.title;
prevY = curr_item._y;
prevH = curr_item.tf.textHeight;
trace(curr_item);
trace(curr_item.tf.textHeight);
}
}
Re: having problem with textHeight rohai
12/18/2006 11:38:22 PM
AddThis Social Bookmark Button