Jump to content
Search Community

alemieux

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by alemieux

  1. Sorry, that really didn't help. With the code I have, it's not like I can set the index of the loader to something other than the order that the queue is set to. At least I don't know how to do it. Every time I call swfs.load() it starts from the beginning of the queue. I want to be able to start from any point in the queue.

     

    var swfs:LoaderMax = new LoaderMax({onComplete:completeHandler,onProgress:progressHandler,onChildComplete:childCompleteHandler});
    
    swfs.append(new SWFLoader("hie.swf", {container:container_mc, autoPlay:false}));
    swfs.append(new SWFLoader("rhapsody.swf", {container:container_mc, autoPlay:false}));
    swfs.append(new SWFLoader("conclusion.swf", {container:container_mc, autoPlay:false}));
    
    
    function progressHandler(e:LoaderEvent):void {
    trace(e.target.progress);
    }
    
    function childCompleteHandler(e:LoaderEvent):void {
    trace(e.target + " loaded");
    e.target.content.visible = false;
    }
    
    function completeHandler(e:LoaderEvent):void {
    trace("all swfs loaded");
    // progress_mc.visible = false;
    initCurrentLoader();
    addEventListener(Event.ENTER_FRAME, trackSWFPlayback);
    }
    
    function initCurrentLoader() {
       loaderIndex++; 
    if (loaderIndex == swfs.numChildren) {
    	//reset back to 0 if the last swf has already played
    	loaderIndex  = 	0;
    }
    
    //dynamically reference current loader based on value of loaderIndex
    
    currentLoader = swfs.getChildAt(loaderIndex);
    
    //make the content of the current loader visible
    
    currentLoader.content.visible = true;
    
    //tell the current loader's swf to to play
    
    currentLoader.rawContent.gotoAndPlay(1);
    }
    
    
    function trackSWFPlayback(e:Event):void {
    //trace(currentLoader.rawContent.currentFrame);
    
    //detect if the loaded swf is on the last frame
    
    if (currentLoader.rawContent.currentFrame == currentLoader.rawContent.totalFrames) {
    
    	trace("swf done");
    
    	//hide and stop current swf
    	currentLoader.content.visible = false;
    	currentLoader.rawContent.stop();
    
    
           //set up and play the next swf
    	initCurrentLoader();
    
    
    }
    }
    playall_btn.addEventListener(MouseEvent.CLICK, loadSWFs);
    
    function loadSWFs(e:MouseEvent):void{
    // load_btn.visible = false;
    swfs.load();
    }

  2. OK, the looping is working perfectly. But what if I wanted to create a table of contents and start playing the loop from another choice instead of the first?

     

    So, this looks like an Array, but apparently it's not:

     

    var swfs:LoaderMax = new LoaderMax({onComplete:completeHandler,onProgress:progressHandler,onChildComplete:childCompleteHandler});
    
    swfs.append(new SWFLoader("hie.swf", {container:container_mc, autoPlay:false}));
    swfs.append(new SWFLoader("rhapsody.swf", {container:container_mc, autoPlay:false}));
    swfs.append(new SWFLoader("conclusion.swf", {container:container_mc, autoPlay:false}));
    

     

    So when I call on swfs.load(); to start the looping, I thought I could pass in a position to start, but it's not possible. I thought the loaderIndex could be incremented, but it doesn't work.

     

    Any suggestions?

  3. Thanks for the response, but wouldn't that code simultaneously load SWFs? I need to load a SWF, play through it and when it's complete, load the next SWF play it, and continue through 6 SWF files and then play at the start again.

     

    If they all get loaded into the same instance (container: this) then I understand I wouldn't need to use unload(). But eventually, I want the administrator to be able to get out of the loop, so an unload() would be necessary then.

  4. LoaderMax is great for loading SWF files. However, I want to be able to load a sequence of SWF files with animations in them and loop their playback. I can use loaderMax to load the next SWF at the end of the previous one, but what do I do when I get to the last one? If each SWF was loaded in the container and the container was defined as container:this, does it wipe out the previous SWF? Do I need to unload the last SWF? Is there an unload function?

×
×
  • Create New...