Awesome, I love typing out a long, detailed question, then having the forum tell me I’m not logged in, erasing the whole message. Way to test my patience. Gaaahhh. ;(
Anyway, we’ll try this again: I’ve been searching for about 3 days for various solutions to this problem, but have yet to find something specific enough, so I guess it’s time to post it.
I’m redesigning my travel blog and using a Flash header that loads a series of external SWFs in a slideshow format, to show some of the site’s content features. See the progress on it here:
http://www.thevagabondproject.com/main
The site’s still very much in-dev, but you’ll see that the Flash header advances through 3 slides (just drafts, mind you) and stops. That’s totally cool with me, as eventually it will have 5 slides, and will have to end on the last slide, which will be a Yahoo Maps API. What I’m trying to accomplish with this header is:
-
Load the series of external SWFs (slide1.swf, slide2.swf, slide3.swf, slide4.swf, map.swf), in order, advancing from one to the next every 5 seconds, and stopping on map.swf, like a slideshow.
-
Allow the user to skip ahead or go back to other frames by clicking on their number/label in the menu in the bottom right (1, 2, 3, 4 and MAP).
-
Show which slide is being viewed by changing the “on” or “rollover” state of the button in the menu (you’ll see the buttons change to blue on rollover) as the slides advance.
-
Show the title of the slide shown in the dynamic text box (“Last seen in…”) as the slides advance.
You’ll see that I’ve accomplished #1, but at the expense of #2. Originally, loading the external SWFs using the buttons was easy, using this code:
slideoneBtn.onRelease = function() {
theLoader.loadClip("location/of/slide1.swf", dropZone);
function onLoadInit(mc:MovieClip) {
trace("content has been loaded into "+mc);
}
}
So on and so forth, for each button. (dropZone is the name of the movie clip that each SWF is loading into) No problem there, until I tried adding this code to advance to the next SWF after 5 seconds, until stopping at the end:
var mcl:MovieClipLoader = new MovieClipLoader();
var list:Object = new Object();
mcl.addListener(list);
var myMovies:Array = new Array("location/of/slide1.swf", "location/of/slide2.swf", "location/of/slide3.swf");
var cont:Number = 0;
function loadSwfs(){
mcl.loadClip(myMovies[cont], dropZone);
}
list.onLoadInit = function(){
clearInterval(interval);
if(cont < myMovies.length){
cont++;
interval = setInterval(loadSwfs, 5000);//defines the wait for next movie load
}
else{
trace("Load complete");
}
}
loadSwfs();
While that code works in itself, (thanks to the authoring of a kirupa forum answer) it also deactivates my buttons. Lame. Eventually I’ll also want to add transition animation between the frames, etc, but for now the question is: how do I use AS2.0 to advance to the next slide every 5 seconds, while still allowing the user to skip around? If possible, I’d also like the timer to stop running if a user clicks a button.
I’m sure I’m just misunderstanding some fundamentals of ActionScript, being a novice, but any help would be greatly appreciated – please let me know if any of this needs more explanation. Thanks in advance for your time.