A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: loading multiple named external swf on single button

  1. #1
    Junior Member
    Join Date
    Apr 2009
    Posts
    23

    Lightbulb 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....?

  2. #2
    Ryan Thomson EvolveDesigns's Avatar
    Join Date
    Oct 2001
    Location
    British Columbia
    Posts
    3,338
    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(
    swfList.length 1){
            
    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(
    ){
            
    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
    Evolve Designs Interactive Media
    the natural selection

  3. #3
    Senior Member
    Join Date
    Apr 2009
    Posts
    117
    hey evolve designs ive tried making this work and it doesnt work :/ is it supposed to actually load the file two.swf or whatever ?

  4. #4
    Senior Member
    Join Date
    Apr 2009
    Posts
    117
    problem solved i used
    loadMovieNum(swfList[i], 10);

  5. #5
    Ryan Thomson EvolveDesigns's Avatar
    Join Date
    Oct 2001
    Location
    British Columbia
    Posts
    3,338
    glad you figured it out.
    Evolve Designs Interactive Media
    the natural selection

  6. #6
    Junior Member
    Join Date
    Apr 2009
    Posts
    23

    Angry thanks a lot .... sorry for late reply

    Quote Originally Posted by EvolveDesigns View Post
    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(
    swfList.length 1){
            
    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(
    ){
            
    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

  7. #7
    Junior Member
    Join Date
    Apr 2009
    Posts
    23

    Hey thanks...!!!It works perfectly

    Quote Originally Posted by imbiren View Post
    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

  8. #8
    Junior Member
    Join Date
    Apr 2009
    Posts
    23

    Thumbs up 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

  9. #9
    Ryan Thomson EvolveDesigns's Avatar
    Join Date
    Oct 2001
    Location
    British Columbia
    Posts
    3,338
    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(
    swfList.length 1){ 
            
    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(
    ){ 
            
    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.
    Evolve Designs Interactive Media
    the natural selection

  10. #10
    Junior Member
    Join Date
    Apr 2009
    Posts
    23
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center