0 Replies Latest reply on Aug 14, 2010 12:39 AM by Kavipriya

    FLV Cue Points and Captions

    Kavipriya

      In FLVPlayback working in as2.0, created cuepoints for FLV and i added
      captions wit xml file. but captions not loading

       

      I did following steps and script.
      *step1: layer 1 for flvplayback
      *step2:layer2 for dynamic text(instance name-txtCaption)
      step3: layer3 for actions and the script is

       

      var nc:NetConnection = new NetConnection();
      nc.connect(null);
      var ns:NetStream = new NetStream(nc);
      //ns.play("speech.flv");
      ns.onMetaData = function(oMeta:Object) {
          trace("onMetaData >");
          trace("\tNumber of cue points: "+oMeta.cuePoints.length);
          for (var i:Number = 0; i<oMeta.cuePoints.length; i++) {
              var oCue:Object = oMeta.cuePoints[i];
              trace("\t\t"+i+": "+oCue.name+", "+oCue.type);
              var captionsXML:XML = new XML();
              captionsXML.ignoreWhite = true;
              captionsXML.onLoad = function():Void  {
                  captions = this.firstChild.childNodes;
                  for (var i:Number = 0; i<captions.length; i++) {
                      ns.addASCuePoint(captions[i].attributes.start,captions[i].firstChild.
      nodeValue);
                  }
              };
              captionsXML.load("cuecaption.xml");
              ns.addEventListener("cuePoint",onCuePoint);

       

              function onCuePoint(evntObj:Object):Void {
                  txtCaption.text = evntObj.info.name;
              }
          }
      };

       

      XML script

       

      <?xml version="1.0" encoding="iso-8859-1"?>
      <captions>
      <caption start="00.000">Black-eyed susans</caption>
      <caption start="38.082">Echinacea</caption>
      <caption start="42.275">hello.......</caption>
      <caption start="56.250">hi.........</caption>
      <caption start="56.250">hi.........</caption>
      </captions>

       

      Plz reply me....

       

      Regards,
      Priya