Changeset 1645
- Timestamp:
- 03/14/11 12:13:19 (2 years ago)
- Location:
- plugins/captions
- Files:
-
- 3 edited
-
js/assets/design.ai (modified) (previous)
-
v5/captions.swf (modified) (previous)
-
v5/src/com/longtailvideo/plugins/captions/Captions.as (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
plugins/captions/v5/src/com/longtailvideo/plugins/captions/Captions.as
r1593 r1645 17 17 18 18 19 /** 20 * Plugin for playing closed captions with a video. 21 **/ 19 /** Plugin for playing closed captions with a video. **/ 22 20 public class Captions extends MovieClip implements IPlugin { 23 21 … … 29 27 30 28 31 /** Reference to the background graphic. **/32 private var _back:MovieClip;33 29 /* Reference to the bar (container for field & back)*/ 34 private var _bar: MovieClip;30 private var _bar:Sprite; 35 31 /** Reference to the controlbar button. **/ 36 32 private var _button:MovieClip; 33 /** Reference to the controlbar button icon **/ 34 private var _buttonIcon:DisplayObject; 37 35 /** The array the captions are loaded into. **/ 38 36 private var _captions:Array; … … 55 53 /** Reference to the dock icon. **/ 56 54 private var _icon:MovieClip; 57 /** Reference to the controlbar button icon **/58 private var _buttonIcon:DisplayObject;59 55 /** XML connect and parse object. **/ 60 56 private var _loader:URLLoader; 57 /** Reference to the outline graphic. **/ 58 private var _outline:Sprite; 61 59 /* Reference to the JW Player. */ 62 60 private var _player:IPlayer; … … 84 82 /** Draw the neccessary graphics to put the captions on stage. **/ 85 83 private function drawClip():void { 86 _bar = new MovieClip();84 _bar = new Sprite(); 87 85 addChild(_bar); 88 _back = new MovieClip(); 89 _back.graphics.beginFill(0x0000,0.75); 90 _back.graphics.drawRect(0,0,400,20); 91 _bar.addChild(_back); 86 _outline = new Sprite(); 87 _bar.addChild(_outline); 92 88 _field = new TextField(); 93 89 _field.width = 400; 94 90 _field.height = 10; 95 _field.y = 5;96 91 _field.autoSize = "center"; 97 92 _field.multiline = true; 93 _field.selectable = false; 98 94 _field.wordWrap = true; 99 95 var fmt:TextFormat = new TextFormat(); … … 102 98 fmt.align = "center"; 103 99 fmt.font = "_sans"; 104 fmt.leading = 4;100 fmt.leading = 5; 105 101 _field.defaultTextFormat = fmt; 106 102 _bar.addChild(_field); 107 103 if (!_config['back']) { 108 _back.alpha = 0;109 104 _field.filters = new Array(new DropShadowFilter(0,45,0,1,2,2,10,3)); 105 _outline.alpha = 0; 110 106 } 111 107 }; … … 217 213 /** Resize this plugin */ 218 214 public function resize(w:Number, h:Number):void { 219 _back.height = _field.height + 10;220 215 _bar.width = w; 221 216 _bar.scaleY = _bar.scaleX; … … 223 218 _bar.y = h - _bar.height - 50; 224 219 } else { 225 _bar.y = h - _bar.height; 226 } 227 //_bar.visible = _config['state']; 220 _bar.y = h - _bar.height - 10; 221 } 228 222 }; 229 223 … … 239 233 _field.htmlText = text; 240 234 } 241 if(_config['back'] && text != '') { 242 _back.alpha = 1; 243 } else { 244 _back.alpha = 0; 245 } 235 setOutline(); 246 236 resize(_player.config['width'], _player.config['height']); 247 237 }; 238 239 240 /** Draw the black boxes around the textlines. **/ 241 private function setOutline():void { 242 _outline.graphics.clear(); 243 for (var i:Number=0; i < _field.numLines; i++) { 244 var metrics:TextLineMetrics = _field.getLineMetrics(i); 245 if(metrics.width > 16) { 246 _outline.graphics.beginFill(0x000000); 247 _outline.graphics.drawRect( 248 metrics.x - 8, 249 i*metrics.height, 250 metrics.width + 16, 251 metrics.height 252 ); 253 _outline.graphics.endFill(); 254 } 255 } 256 }; 248 257 249 258
Note: See TracChangeset
for help on using the changeset viewer.
