Flash Builder 4 -> RichEditableText

Posted by muchag | ActionScript 3.0,Flash Builder 4 |
初回投稿:2010-07-19 (月) 5:11:58 | 最終更新:2010-07-25 (日) 2:22:59

HTML タグの反映
[mxml][/mxml] [as3onfx4]import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.elements.Configuration;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.formats.TextDecoration;
import flashx.textLayout.formats.TextLayoutFormat;

private function init():void {
var txt:String = “Check out our website at flexexamples.com.”;

var cfg:Configuration = TextFlow.defaultConfiguration;

var normalFmt:TextLayoutFormat = new TextLayoutFormat(cfg.defaultLinkNormalFormat);
normalFmt.color = 0xFF0000; // red
normalFmt.textDecoration = TextDecoration.NONE;

var hoverFmt:TextLayoutFormat = new TextLayoutFormat(cfg.defaultLinkHoverFormat);
hoverFmt.color = 0xFF00FF; // purple
hoverFmt.textDecoration = TextDecoration.UNDERLINE;

cfg.defaultLinkNormalFormat = normalFmt;
cfg.defaultLinkHoverFormat = hoverFmt;

ret.textFlow = TextConverter.importToFlow(txt, TextConverter.TEXT_FIELD_HTML_FORMAT, cfg);
}[/as3onfx4]

Flex Examples:Customizing the appearance or a hyperlink in a TextFlow object in Flex 4
こちらよりの丸パクリ。。。
 

リンクの実装(a タグ)
[as3onfx4]import flashx.textLayout.elements.LinkElement;
import flashx.textLayout.events.FlowElementMouseEvent;
import mx.controls.Alert;

private function init():void {
var myString:String = “検索サイト:Google“;
myString.replace(/^$/, ““);

var myRichEditableText:RichEditableText = new RichEditableText();
myRichEditableText.text = myString;
}

protected function linkElement_clickHandler(event:FlowElementMouseEvent):void {
var linkEl:LinkElement = event.flowElement as LinkElement;
event.stopImmediatePropagation();
event.preventDefault();
}[/as3onfx4]

<参考サイト>
Flex Examples:
Creating a LinkElement in a Spark RichEditableText control in Flex 4
 

テキストの折り返し

width プロパティを設定しないと折り返しは実現しない。

Posted by muchag | ActionScript 3.0,Flash Builder 4 |
初回投稿:2010-07-19 (月) 5:11:58 | 最終更新:2010-07-25 (日) 2:22:59

コメントはまだありません »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment