开发者

Custom bullets in Flash

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!


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.


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.


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.


You can enter the bullet points manually and style them how you like but then you lose the indentation.

<font color='#FFE400'>  •   </font> My bulleted item<br>
<font color='#FFE400'>  •   </font> My bulleted item<br>
<font color='#FFE400'>  •   </font> My bulleted item<br>

There is also another approach on this site

http://blog.formatlos.de/2009/06/18/styling-html-textfield-bullet-points/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜