Setting word wrapping on a Spark List control in Flex 4

The following example shows how you can enable word wrapping on a Spark List control in Flex 4 by overriding the default layout with a VerticalLayout object and set its horizontalAlign property to “justify” (instead of the default “contentJustify”).

Full code after the jump.

The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see To download the latest nightly build of the Flex 4 SDK, see

For more information on getting started with Flex 4 and Flash Builder 4, see the official Adobe Flex Team blog.

<?xml version="1.0" encoding="utf-8"?>
<!-- -->
<s:Application name="Spark_List_layout_horizontalAlign_test"
    <s:List id="lst"
            horizontalCenter="0" verticalCenter="0">
            <s:VerticalLayout gap="0" horizontalAlign="justify" />
                <fx:Object label="Lorem ipsum dolor sit amet, consectetur adipiscing elit." />
                <fx:Object label="Fusce pulvinar nisi ac leo rhoncus nec malesuada arcu accumsan." />
                <fx:Object label="Sed at metus eu mauris malesuada ornare." />
                <fx:Object label="Vestibulum et ante non arcu facilisis sagittis." />
                <fx:Object label="Praesent euismod bibendum tortor, pharetra pharetra nibh ultricies convallis." />
                <fx:Object label="Sed at mi quis urna lobortis mattis." />
                <fx:Object label="Nulla aliquet ante nec nisi auctor et pharetra leo blandit." />

This entry is based on a beta version of the Flex 4 SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex 4 SDK.

6 thoughts on “Setting word wrapping on a Spark List control in Flex 4

      1. I tested in 4.5.1 and it doesn’t work. :( I’ve been scouring the web trying to figure this out and nothing works so far!

  1. mmm, in Flex 4.5.X, you must implement a custom item renderer for a (spark) list. specifically, use a label (o a textarea if you like so) inside the item renderer, and set its width to 80% (for example). if you use a icon for the item for render, use label width for adjusting.

    hope thie helps. :)

Comments are closed.