all groups > flash actionscript > january 2007 >
You're in the

flash actionscript

group:

Playing a swf using an external xml


Playing a swf using an external xml Xud
1/15/2007 7:13:33 PM
flash actionscript: 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[i].attributes.start),
captions[i].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
Re: Playing a swf using an external xml soupycafe
1/15/2007 7:46:12 PM
You could add another attribute to the cues that could play the different
frames.

<caption start="26" whichframe="2">This is cue14.</caption>

then have a conditional statement
---- if(whichframe!=undefined){gotoandStop();---
Did I understand correctly?



Re: Playing a swf using an external xml Xud
1/15/2007 7:54:36 PM
I assume I put "2" in the "undefined" part (or whatever number I have assigned
for whichframe)

how to I modify the gotoandstop action to work on an imported swf timeline
instead of the main timeline?

AddThis Social Bookmark Button