Changeset 165


Ignore:
Timestamp:
02/18/09 16:45:52 (4 years ago)
Author:
jeroen
Message:

Fixed the captions to also load .txt Subrip files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/as3/com/jeroenwijering/plugins/Captions.as

    r161 r165  
    152152        private function itemHandler(evt:ControllerEvent=null):void { 
    153153                current = 0; 
    154                 captions = new Array(); 
    155154                var fil:String = view.playlist[view.config['item']]['captions.file']; 
    156155                if(fil) {  
     
    169168        /** Captions are loaded; now display them. **/ 
    170169        private function loaderHandler(evt:Event):void { 
    171                 if(config['file'].substr(-3) == 'srt') { 
     170                var ext:String = config['file'].substr(-3); 
     171                captions = new Array(); 
     172                if(ext == 'srt' || ext == 'txt') { 
    172173                        captions = SRTParser.parseCaptions(String(evt.target.data)); 
    173174                } else {  
     
    201202                        } 
    202203                } 
    203  
    204204        }; 
    205205 
     
    208208        private function timeHandler(evt:ModelEvent):void { 
    209209                var pos:Number = evt.data.position; 
    210                 if(captions.length > 0 && (captions[current]['begin'] > pos || captions[current+1]['begin'] < pos)) { 
     210                if(captions && (captions[current]['begin'] > pos || captions[current+1]['begin'] < pos)) { 
    211211                        setCaption(pos); 
    212212                } 
Note: See TracChangeset for help on using the changeset viewer.