views:

165

answers:

3

Is there a way to make a bulleted list in flash with custom bullets? If so, can this be used from within a TextArea in Flex (mx.controls.TextArea) when setting htmlText?

For example:

<li>Item</li>
<li>Item</li>

The list above will render fine when set into a TextArea using htmlText (versus just setting the text property). The rendered text will have standard vanilla bullets. Is there a way to style these bullets with custom images, like you can in standard HTML/CSS?

Thanks!

+2  A: 

I don't want to jump the gun and just say no. But i really don't think you can. I've never been able to and i cant find any docs or examples that even talk about it. So i'm just going to have to concede to no, there isn't currently a way.

the best you can do is to just draw the list yourself using standard flex components.

greg
I'm fairly sure you're right. Seems really... stupid.
TTar
i've always felt like html text was just an afterthought with flash. Somthing Adobe could have to just be like "Look man were cool, HTML text is where its at! were hip with the kids, lets be friends, wanna get high?"
greg
In Flex 4 there are a lot of improvements to the rendering of HTML and the ability to apply stylesheets. You may have more luck in that version of Flex when it comes out.
Ben Johnson
@greg I've always felt there are a lot of things which were afterthoughts to Flex...
Christopher W. Allen-Poole
Regarding Flex 4 - I looked, the new text layout framework does NOT support bullets at all..
TTar
+1  A: 

I'll say for certain that you can't. TextArea inevitably references a generic flash.text.TextField which handles the rendering of the HTML text (it actually calls, createInFontContext(UITextField) to create its text renderer and it UITextField inherits from TextField). If you look at the TextField documentation:

TextField documentation

you will notice that this renders using a flash.text.StyleSheet. If you look at those docs:

StyleSheet documentation

you'll see it doesn't support custom bullets.

You're really left with few alternatives. You could try to either overlay the bullets with images manually (with the Image class, for example), or use alternate Flex components to render the list.

Christopher W. Allen-Poole
+1  A: 

Yeah, use a HBox containing two items:

  1. a bullet image of your choice
  2. and the list item

Then just put the HBox inside of a Repeater component.

<mx:Repeater dataProvider=" [refer to an array with your list] ">
    <mx:HBox>
        <mx:Image source="{ [refer to your image class of choice here] }"/>
        <mx:Label text="{data.text}"/>
    <mx:HBox>
<mx:Repeater>

This is especially great for dynamic lists.

Adrian