Please Help problem on loading multiple external swf on single button... I mean on click of next or previous button may I load external swf with different name on targeted instance....?
Printable View
Please Help problem on loading multiple external swf on single button... I mean on click of next or previous button may I load external swf with different name on targeted instance....?
Do you mean like storing a list of the swf files, then when a user clicks next it jumps to the next swf file in the list and back goes back one in the list? If so you can do that using an array.. I was about to explain how, but hey it would be easier for me to just code something up for you! Check it out below, I've tried to comment it enough so you can figure out how it works. ;)
enjoy! and welcome to FK :DPHP Code://your swf list can be anything and any length. I named them one two three so you can easily test that it works
var swfList:Array = new Array("one.swf", "two.swf", "three.swf", "four.swf");
var i:Number = -1;
//where next button has an instance name of 'nextBtn'
nextBtn.onRelease = function(){
i++;
if(i > swfList.length - 1){
i = 0;
}
trace(swfList[i]);
//your load funtion here like loadMovieNum(swfList[i], 1); or instance name.loadMovie(swfList[i]);
}
//where previous button has an instance name of 'prevBtn'
prevBtn.onRelease = function(){
i--;
if(i < 0 ){
i = swfList.length - 1;
}
trace(swfList[i]);
//your load funtion here like loadMovieNum(swfList[i], 1); or instance name.loadMovie(swfList[i]);
}
hey evolve designs ive tried making this work and it doesnt work :/ is it supposed to actually load the file two.swf or whatever ?
problem solved i used
loadMovieNum(swfList[i], 10);
glad you figured it out. ;)
Hy thanks a lot I also like your work on ur website particularly marriage album site.....Puppet site link is not working.......The things work perfectly but I want first swf of the list immediately on load..I mean when we test movie first swf should appear. I also want all this swf appear dynamically on click of respective named button on stage bottom. I know loadmovienum script on each respective button but may I load it dynamically through button...?
biren
if you wanted to load the first swf file imediately use this code instead:
As for buttons to load specific movies from the list (array) you call each by number, the first in the list being number 0 so if you had a button to load the first item in the list (one.swf) you would code it likePHP Code://your swf list can be anything and any length. I named them one two three so you can easily test that it works
var swfList:Array = new Array("one.swf", "two.swf", "three.swf", "four.swf");
var i:Number = 0;
loadMovieNum(swfList[i], 1);
//where next button has an instance name of 'nextBtn'
nextBtn.onRelease = function(){
i++;
if(i > swfList.length - 1){
i = 0;
}
trace(swfList[i]);
//your load funtion here like loadMovieNum(swfList[i], 1); or instance name.loadMovie(swfList[i]);
}
//where previous button has an instance name of 'prevBtn'
prevBtn.onRelease = function(){
i--;
if(i < 0 ){
i = swfList.length - 1;
}
trace(swfList[i]);
//your load funtion here like loadMovieNum(swfList[i], 1); or instance name.loadMovie(swfList[i]);
on(release){
loadMovieNum(swfList[0], 1);
}
or if you wanted to load the third item in the list (three.swf) you would code it like:
on(release){
loadMovieNum(swfList[2], 1);
}
Thanks for the comments about my site. I haven't changed a thing there in seven years so yeah, probably lots of dead links lol... I don't do much contract work anymore so the site is quite stale.
thanks master....
It works perfectly....
thanks a lot
biren