2 Replies Latest reply on Jan 15, 2007 11:54 AM by Xud

    Playing a swf using an external xml

    Xud
      I have been trying to figure out if this is possible:

      I have a flash project setup with an imported video that narrates animation from an imported swf, I have been able to script working captions for the video by using an external xml file. Is it at all possible to use this xml file to also be used to play different parts of the imported swf file in the project?

      <captions>
      <caption start="1">This is cue1</caption>
      <caption start="10">This is cue2</caption>
      <caption start="17">This is cue3</caption>
      <caption start="26">This is cue14.</caption>
      </captions>


      So for example when cue2 is called is there something that can be written in the xml (or in corresponding actionscript) that will also play a certain frame in the imported swf file?

      Any help on this would be appreciated.

      Here is the rest of my code if it is needed for reference:

      loadMovie("010101.swf", swf);

      import mx.video.*;

      myVid.autoPlay = true;
      myVid.contentPath = "010101.flv";
      myVid.autoRewind = true;

      var captions:Array;

      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++) {
      myVid.addASCuePoint(Number(captions .attributes.start), captions.firstChild.nodeValue);
      };

      };

      captionsXML.load("cueData_0101.xml");

      myVid.addEventListener("cuePoint", onCuePoint);

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


      The instance names are:
      myVid: for the video
      txtCaption: for the caption text box
      swf: for the imported swf