开发者

How to make a paragraph text that previews a short amount then a link to expand the rest in Flex?

I want to be able to display a paragraph where if the text being shown is (say) over 15 lines long, then a link text will appear and if click it will expand. example:

Th开发者_StackOverflow中文版is is a long line for here

so i need to make more display

but i cant so what will (More)... <== this more link will be clicked and the rest will show up below

this paragraph expanded to show

the rest of it. (Close)... <== this close link will be clicked and the rest of the page will be hidden again

Can this be done in Flex?

Thankx again for all help and info

Here is a link example done in javascript http://tech-cats.net/blog/examples/createParagraphPreview.html


You can achieve this using mxml as follows:

<mx:Label text="The quick brown fox jumped over the lazy dog."
truncateToFit="true"
maxWidth="100" />

The same thing can be achieved using actionscript like :

var label:Label = new Label();
label.text = "The quick brown fox jumped over the lazy dog.";
label.truncateToFit = true;
label.maxWidth = 100;

Then you can handle MouseEvent.CLICK to drop truncateToFit property to false and show up the rest of the page.

Hope this helps.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜