A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: Loading SWF files in order???

  1. #1
    Member
    Join Date
    Jun 2006
    Posts
    66

    Loading SWF files in order???

    Please!!!!

    Could someone tell me an easy way or write out the script. I'm trying to load 30 external SWF files in order from 1.swf -30.swf ???

    Thank you,
    Liz

  2. #2
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,875
    With a preloader or without? simple bar preloader?
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  3. #3
    Member
    Join Date
    Jun 2006
    Posts
    66
    Without a preloader. These will be loading in the background of another movie.


    Liz

  4. #4
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,875
    This will load movies 1.swf to 30.swf in levels 1 to 30 respectively, one by one in order:

    Code:
    var count:Number = 0;
    var my_mcl:MovieClipLoader = new MovieClipLoader();
    var loadListener:Object = new Object();
    my_mcl.addListener(loadListener);
    
    _global.aQueue = new Array();
    
    _global.startQueue = function():Void {
    	my_mcl.loadClip(aQueue[0].source, aQueue[0].level);
    }
    
    loadListener.onLoadInit = function() {
    	count++;
    	if (count<aQueue.length) {
    		my_mcl.loadClip(aQueue[count].source, aQueue[count].level);
    	}
    	if (count == aQueue.length) {
    		count = 0;
    		aQueue.length = 0; //everything has loaded so now empty array so its ready for another queue push
    	}
    };
    
    
    //load movies 1.swf - 30.swf in levels 1 to 30
    
    for(var i:Number = 1 ; i <=30 i++){
     aQueue.push({source: i+".swf", level: i});
    }
    
    startQueue();
    P.S ive defined the array and startQueue function as global, so no matter where you are you can easily start and run a queue..
    Last edited by silentweed; 06-13-2006 at 04:16 AM.
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  5. #5
    Member
    Join Date
    Jun 2006
    Posts
    66
    Thank you... Thank you.... Thank you....


    Liz

  6. #6
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,875
    yw yw yw
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  7. #7
    Junior Member
    Join Date
    Oct 2005
    Posts
    27
    I am trying to do this exact same thing but when I try to use your code I am getting errors. I am really bad with action scripts - I really need some help, please! I have spent the last three days trying to figure this out. The problem is with this section:

    _global.startQueue = function():Void {
    my_mcl.loadClip(aQueue[0].source, aQueue[0].level);
    }

    These are the error messages I am getting:

    **Error** Scene=Scene 1, layer=Layer 18, frame=1:Line 8: '{' expected
    _global.startQueue = function():Void {

    **Error** Scene=Scene 1, layer=Layer 18, frame=1:Line 10: Unexpected '}' encountered
    }


    Please help me!

  8. #8
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,875
    Make sure your publish settings are set for flash player 7 and actionscript 2
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  9. #9
    Junior Member
    Join Date
    Oct 2005
    Posts
    27
    ok. I have got it to work - to load all the movies. Now how do I controll how they play back - right now they just all show up at the same time. I know should have posted these questions in the newbie section - I am in way over my head. Please help!

  10. #10
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,875
    locally they will show up at the same time as there is no speed issue..online they will show one by one as they load..
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  11. #11
    Junior Member
    Join Date
    Oct 2005
    Posts
    27
    So it will play all of 1 and then when that is finished it will start 2 and when that is finished it will start 3, etc? I want all of the movies to load and then play in order.

  12. #12
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,875
    Hi

    No the above script only loads them in order it does not play them in order.. to do that what u need to do is put a stop action at the beginning of each of the movies(except the first movie) and on the end frame of each movie you tell the next movie to start playing
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  13. #13
    Junior Member
    Join Date
    Oct 2005
    Posts
    27
    Is there a way to control the movies from the main movie? If I wanted to have a stop, play, and rewind button. And also, there is a little pause between each movie, is there any way to get rid of that? Thanks for answering all my questions!

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