Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Aligning the Label in a Tree Control

DZone's Guide to

Aligning the Label in a Tree Control

· Web Dev Zone
Free Resource

Deploying code to production can be filled with uncertainty. Reduce the risks, and deploy earlier and more often. Download this free guide to learn more. Brought to you in partnership with Rollbar.

If you've ever rendered images in a tree control, you may have noticed both the image and the label are effectively top, left justified. There's no CSS solution to changing this, the answer is to extend Flex's TreeItemRenderer and move the renderer's label in ActionScript.



Here's my version. Inside updateDisplayList() are a few lines of ActionScript that reposition label to make right justified and vertically centered. The SWF is source code enabled and that source is available here.

Deploying code to production can be filled with uncertainty. Reduce the risks, and deploy earlier and more often. Download this free guide to learn more. Brought to you in partnership with Rollbar.

Topics:

Published at DZone with permission of Simon Gladman, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}