Packagevegas.media.subtitles
Classpublic class SRTParser
InheritanceSRTParser Inheritance GenericParser Inheritance Object

Parses a specific string (SRT subtitle format) and creates an Array of Caption objects.

Example :

     import vegas.media.subtitles.SRTParser ;
     
     var source:String  = "1\r" ;
                   srt += "00:00:20,000 --> 00:00:24,400\r" ;
                   srt += "You can use a SRTParser instance\r" ;
                   srt += "to eval your external subtitles files.\r" ;
                   srt += "\n" ; 
                   srt += "2\r" ; 
                   srt += "00:00:24,600 --> 00:00:27,800\r" ; 
                   srt += "You must use the Array of Caption objects.\r" ;
                   srt += "\n" ; 
                   srt += "3\r" ; 
                   srt += "00:00:30,600 --> 00:00:35,200\r" ; 
                   srt += "You can creates your custom subtitle engine now." ;
      
      var parser:SRTParser = new SRTParser(srt) ;
      
      var captions:Array   = parser.eval() ;
      
      trace( " captions:" + captions ) ;
     



Public Properties
 PropertyDefined By
 Inheritedch : String
The current character to parse.
GenericParser
 Inheritedpos : uint
The current parser position in the string expression to parse.
GenericParser
 Inheritedsource : String
[read-only] Indicates the String source representation of the parser (read-only).
GenericParser
Public Methods
 MethodDefined By
  
SRTParser(source:String = null)
Creates a new SRTParser instance.
SRTParser
  
eval():Vector.<Caption>
Evaluates the String source and return a list of SRT captions.
SRTParser
 Inherited
getChar():String
Returns the current char in the parse process.
GenericParser
 Inherited
getCharAt(pos:uint):String
Returns the char in the source to parse at the specified position.
GenericParser
 Inherited
hasMoreChar():Boolean
Indicates if the source parser has more char.
GenericParser
 Inherited
next():String
Returns the next character in the source of this parser.
GenericParser
Constructor Detail
SRTParser()Constructor
public function SRTParser(source:String = null)

Creates a new SRTParser instance.

Parameters
source:String (default = null) — The string expression to parse.
Method Detail
eval()method
public function eval():Vector.<Caption>

Evaluates the String source and return a list of SRT captions.

Returns
Vector.<Caption>