给视频加字幕
程序员文章站
2022-05-07 16:46:14
...
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" backgroundColor="0" viewSourceURL="srcview/index.html"> <fx:Style> @namespace s "library://ns.adobe.com/flex/spark"; @namespace mx "library://ns.adobe.com/flex/mx"; s|Label { font-size:14; font-family:"Arial"; } </fx:Style> <fx:Script> <![CDATA[ import mx.events.FlexEvent; private var myTimer:Timer; protected function bc_creationCompleteHandler(event:FlexEvent):void { scroller.setStyle("verticalScrollPolicy", "off"); this.myTimer=new Timer(100); this.myTimer.addEventListener(TimerEvent.TIMER, onChange); this.myTimer.start(); } private function onChange(e:TimerEvent):void { var temp:Number=this.scroller.verticalScrollBar.value; if (temp < this.scroller.verticalScrollBar.maximum) { this.scroller.verticalScrollBar.value=this.scroller.verticalScrollBar.value + 5; } else { this.myLabel.visible=false; this.scroller.verticalScrollBar.value=0; this.myLabel.visible=true; } } ]]> </fx:Script> <s:Group horizontalCenter="0" verticalCenter="0"> <s:VideoDisplay source="assets/s.flv" loop="true" muted="{this.myMuted.selected}"/> <s:BorderContainer width="200" height="300" right="0" top="10" bottom="10" backgroundColor="0" backgroundAlpha=".4" id="bc" creationComplete="bc_creationCompleteHandler(event)" borderVisible="false"> <s:VGroup width="100%" height="100%"> <s:Group width="100%" height="50"> <s:CheckBox id="myMuted" selected="true" label="muted?" color="white"/> </s:Group> <s:Scroller width="100%" height="200" id="scroller"> <s:Group width="200" clipAndEnableScrolling="true"> <s:Label color="white" id="myLabel" text="字幕 内容" width="100%" paddingLeft="10" paddingRight="10" paddingTop="200" paddingBottom="200"/> </s:Group> </s:Scroller> </s:VGroup> </s:BorderContainer> </s:Group> </s:Application>