Changeset 155
- Timestamp:
- 02/05/09 03:08:50 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/as3/com/jeroenwijering/plugins/Accessibility.as
r149 r155 84 84 public function initializePlugin(vie:AbstractView):void { 85 85 view = vie; 86 if(view.config['audio']) { config['audio'] = view.config['audio']; } 87 if(view.config['captions']) { config['captions'] = view.config['captions']; } 88 if(!config['captions'] && !config['audio']) { 89 clip.visible = false; 90 return; 91 } 86 92 view.addControllerListener(ControllerEvent.ITEM,itemHandler); 87 93 view.addControllerListener(ControllerEvent.RESIZE,resizeHandler); … … 90 96 clip.tf.autoSize = TextFieldAutoSize.CENTER; 91 97 format = new TextFormat(null,config['fontsize']); 92 if(view.config['audio']) { config['audio'] = view.config['audio']; }93 if(view.config['captions']) { config['captions'] = view.config['captions']; }94 98 hide(config['hide']); 95 99 mute(config['mute']); … … 172 176 }; 173 177 174 /** Set buttons in the controlbar **/ 178 /** Set buttons in the controlbar **/ 175 179 private function setButtons():void { 176 180 if(config['captions']) { … … 228 232 /** Check timing of the player to sync captions. **/ 229 233 private function timeHandler(evt:ModelEvent):void { 230 if(captions.length == 0) {231 return;232 }233 234 var cur:Number = -1; 234 235 var pos:Number = evt.data.position; 235 // sync up the captions (only if needed).236 // sync up the captions if needed. 236 237 for(var i:Number=0; i<captions.length; i++) { 237 238 if(captions[i]['begin'] < pos && captions[i]['end'] > pos) { … … 240 241 } 241 242 } 242 if(cur != current) { setCaption(cur); } 243 // and sync up the audio (only if needed). 243 if(cur > -1 && cur != current) { 244 setCaption(cur); 245 } 246 // sync up the audio if needed. 244 247 if(channel && view.config['state'] == ModelStates.PLAYING && Math.abs(pos-channel.position/1000) > 0.5) { 245 248 channel.stop();
Note: See TracChangeset
for help on using the changeset viewer.
