如何设置FLVPlaybackCaptioning组件用于字幕的字体?使用textarea的style属性不会做任何事情,并且使用TextFormat会使文本变为空白,即使嵌入了字体。
答案 0 :(得分:2)
看起来字体以及文本的其他属性是在读取字幕的XML文件中指定的(这来自documentation):
<?xml version="1.0" encoding="UTF-8"?>
<tt xml:lang="en" xmlns="http://www.w3.org/2006/04/ttaf1" xmlns:tts="http://www.w3.org/2006/04/ttaf1#styling">
<head>
<styling>
<style id="1" tts:textAlign="right"/>
<style id="2" tts:color="transparent"/>
<style id="3" style="2" tts:backgroundColor="white"/>
<style id="4" style="2 3" tts:fontSize="20"/>
</styling>
</head>
<body>
<div xml:lang="en">
<p begin="00:00:00.50" dur="500ms">Four score and twenty years ago</p>
<p begin="00:00:02.50"><span tts:fontFamily="monospaceSansSerif,proportionalSerif,TheOther"tts:fontSize="+2">our forefathers</span> brought forth<br /> on this continent</p>
<p begin="00:00:04.40" dur="10s" style="1">a <span tts:fontSize="12 px">new</span> <span tts:fontSize="300%">nation</span></p>
<p begin="00:00:06.50" dur="3">conceived in <span tts:fontWeight="bold" tts:color="#ccc333">liberty</span> <span tts:color="#ccc333">and dedicated to</span> the proposition</p>
<p begin="00:00:11.50" tts:textAlign="right">that <span tts:fontStyle="italic">all</span> men are created equal.</p>
<p begin="15s" style="4">The end.</p>
</div>
</body>
</tt>
那么组件可能不希望你覆盖那些?
答案 1 :(得分:1)
//为FLVPlaybackCaptioning实例创建一个监听器,监听textfield / target的创建,例如。
myFLVPlybkcap.addEventListener(CaptionTargetEvent.CAPTION_TARGET_CREATED, captionTargetCreatedHandler);
//当发生这种情况时,将文本字段的'defaultTextFormat'设置为您自己的...
private function captionTargetCreatedHandler(e:CaptionTargetEvent):void{
var myTextFormat:TextFormat = new TextFormat();
myTextFormat.font = "Arial";
myTextFormat.color = 0x00FF00;
myTextFormat.size = 18;
(e.captionTarget as TextField).defaultTextFormat = myTextFormat;
}