as3-lib-subtitle is a library to load subtitle using some common formats. The lib has built-in support for the .srt and .sub formats, allowing developer to load those subtitle files and parse them. After the parsing is complete, it’s possible to retrieve the subtitle text by line or by time. The lib also has a display package with a subtitle viewer, a class that abstracts and encapsulate the process of displaying subtitles on the screen.

Two events are available to monitor the lib work. One is fired when a new subtitle is loaded, the other one is fired when it’s time to display a new line. Every text/line in the subtitle is handled as an item containing several information, such as its index, start/end time, duration and text.


var srt:SRTResource;
srt = new SRTResource();
srt.parse("1\n00:00:15,431 --> 00:00:16,898\nHere goes the subtitle lines...");

var strTime:String = "00:00:15,431";
SRTResource.getTimeStamp(strTime); // Returns 15431

var findedsubitem:SubTitleItem = srt.getByTime(9999999);

// Load external subtitle file
var subtitle:SRTResource = new SRTResource();
subtitle.addEventListener(SubtitleEvent.LOADED_SUBTITLE, function(e:Event):void{
Misc. URL.