您的位置:首页 > 其它

Flex的tool tips中使用嵌入字体的例子

2009-11-11 13:35 537 查看
Flex具有很强的表现力,除了可以将枯燥的数字用形象的图表来描画,而个性化字体的使用增加了其表现力。下面的例子演示了如何如何在一个tool tip中使用嵌入的字体。
让我们先来看一下Demo,输入框得到焦点或者鼠标移到输入框上(
可以右键View Source或点击这里察看源代码
Download: main.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white"
creationComplete="init();">

<mx:Style>
@font-face {
src: local("Comic Sans MS");
fontWeight: normal;
fontFamily: ComicSansMSEmbedded;
}

.errorTip {
border-style: "errorTipAbove";
fontFamily: "ComicSansMSEmbedded";
fontSize: 12;
fontWeight: normal;
}
</mx:Style>

<mx:Script>
<![CDATA[
import mx.events.ToolTipEvent;
import mx.controls.ToolTip;

private function init():void {
ToolTip.maxWidth = textInput.width;
}

private function textInput_toolTipShown(evt:ToolTipEvent):void {
var tt:ToolTip = evt.toolTip as ToolTip;
tt.x = textInput.x;
tt.y = (textInput.y - tt.height);
tt.rotation = 5;
}
]]>
</mx:Script>

<mx:TextInput id="textInput" text="{new Date().toDateString()}"
errorString="The quick brown fox jumped over the lazy dog"
toolTipShown="textInput_toolTipShown(event);" />

</mx:Application>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: