-
XML and External SWFs
I am trying to figure out how to read an XML file containing a list of the swfs I want to import, pause for 8 seconds to allow the swf to run and then continue the loop with the next swf.
I am reading the XML correctly but I am having an issue creating the timer to pause the for loop for 8 seconds between slide.
-Chris
-
Senior Member
How are u pausing the loop ?
-
Vinayak-
setInterval(pauseLoop(), 8000);
With pauseLoop being a function currently tracing a piece of text so I know it has hit the function. The traceloop is activate but there is no pause occuring. I have tried it without the parens "()" but setInterval doesn't seem to function without them.
-
Senior Member
Can we have ur source files/FLA so that we can check and diagnose the issue much better.
Last edited by vinayak.kadam; 07-13-2010 at 12:09 AM.
Reason: typo!!!!
As ever,
Vinayak Kadam
-
Vinayak-
Thanks for your thoughts on this, I figured a way to make the script function the way I needed to (see below) although it isn't 100% the best way. The best way would be to start loading the follow-up swf as the first one plays. Once the one on top is done playing, the followup would play while loading the next one in the background.
My current method simply waits for 11 seconds and begins to load and play the next swf. Works fine for most fast connections, but a slower connection would break I am sure.
Code:
stop();
import mx.utils.Delegate;
// declare a new XML instance
var slides_xml:XML = new XML();
_global.i = 1;
function pauseLoop (family) {;
loadMovie(family.childNodes[i].childNodes[0], "_level10");
i++;
if (i > slides.length-1) {
clearInterval(timer);}
}
function onXmlLoaded(success:Boolean) {
if (success) {
var family = slides_xml.firstChild;
_global.slides = family.childNodes;
loadMovie(family.childNodes[0].childNodes[0], "_level10");
_global.timer = setInterval(pauseLoop, 11000, family);
} else {
trace('error reading XML');
}
}
function init() {
// ignore tabs, returns, and other whitespace between nodes
slides_xml.ignoreWhite = true;
// set the scope of the onLoad function to the main timeline, not peoplexml
slides_xml.onLoad = Delegate.create(this, onXmlLoaded);
// start loading the file
slides_xml.load("fluid.xml");
}
init();
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|