-
loading multiple named external swf on single button
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....?
-
Ryan Thomson
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.
PHP 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]); }
enjoy! and welcome to FK
-
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);
-
Ryan Thomson
glad you figured it out.
-
thanks a lot .... sorry for late reply
Originally Posted by EvolveDesigns
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.
PHP 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]);
}
enjoy! and welcome to FK
Things work but I am not viewing external swf but instead of that it comes as a name in output window.... Sorry I am newcommer in scripting and I use loadmovienum before trace but it does not work please guide me .
thanks
-
Hey thanks...!!!It works perfectly
Originally Posted by imbiren
Things work but I am not viewing external swf but instead of that it comes as a name in output window.... Sorry I am newcommer in scripting and I use loadmovienum before trace but it does not work please guide me .
thanks
-
can we load one.swf (the first swf of list) on load
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
-
Ryan Thomson
if you wanted to load the first swf file imediately use this code instead:
PHP 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]);
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 like
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
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
|