Hi everyone, I'm new here. Anyway, for the past few days I have been researching and trying out xml-based captioning of flash videos. Recently, I have successfully recreated one tutorial which I found
here. This method uses a class to inserts a different swf file (at runtime) to the swf file containing the flv and acts as a template to the subtitles.
Unfortunately, when I integrated this to the current project that I have, it slows down the entire movie because of the classes used. Now, I have found
www.actionscript.org/resources/articles/518/1/Creating-subtitles-for-flash-video-using-XML/Page1.html+http://www.actionscript.org/resources/articles/518/1/Creating-subtitles-for-flash-video-using-XML/Page1.html&hl=en&ct=clnk&cd=1&gl=ph&client=firefox-a]another tutorial[/url], which is a bit less complicated than the first one. However, when I followed the instructions and test out to see what happens, no subtitles appear after all. By the way, I am not an expert of actionscript.
Okay, so these are the things I would want to ask you guys. Is there anything wrong with this script which makes it fail to display the subtitles? This by the way is the script inserted into the frame of the layer that contains the FLV file. Thanks, in advance. The code below uses a class XModel, the file can be found at the tutorial from actionscripts.org which I mentioned, earlier.
Code:
var theContent:XModel = new XModel();
var listener = new Object();
theContent.addEventListener("onModelledObject", listener);
theContent.load("xml/cuepoints.xml");
var arr_cue_points:Array = new Array();
listener.onModelledObject = function(eventObject:Object):Void {
var cuepoints:Object = eventObject.modelledObject;
for(kk=0; kk<cuepoints.cuepoint.length; kk++){
var cueObj:Object = new Object();
cueObj.cueTitle = cuepoints.cuepoint[kk].cuename[0].text;
cueObj.cueTime = cuepoints.cuepoint[kk].cuetime[0].text;
cueObj.cueText = cuepoints.cuepoint[kk].subtitle[0].text;
arr_cue_points[cueObj.cueTitle] = cueObj;
createCuepoint(cueObj.cueTitle, cueObj.cueTime);
}
}
function createCuepoint(cTitle:String, cTime:String):Void{
var cuePt:Object = new Object(); //create cue point object
cuePt.time = Number(cTime);
cuePt.name = cTitle;
cuePt.type = "actionscript";
video1.addASCuePoint(cuePt); //add AS cue point
}
//populate cuepoints...
var lastCue:Number;
var listenerObject:Object = new Object();
listenerObject.cuePoint = function(eventObject:Object):Void {
var str_name = eventObject.info.name.toString();
_root.txt_output.text = arr_cue_points[str_name].cueText;
}