dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [AS2] Load swfs from array back-to-back

  1. #1
    Member
    Join Date
    Aug 2006
    Posts
    96

    [AS2] Load swfs from array back-to-back

    Hey all,

    I am working on a having external swfs get loaded into the main swf one by one from an array.

    I can get the first one to load, but it just keeps on playing the first item in the array over and over, instead of loading the next movie. I have a container on my stage, cleverly named "container" and I am using AS2 and loadMovie.

    I am guessing my conditon on my if statement is off, but I am not sure how to tell the onEnterFrame to check the currentframe of the loaded swf and not the container itself. I might be way off, but in my mind I feel like this mostly makes sense, but knowing Flash it is probably not nearly enough coding. Any help would be appreciated!

    I might also add this won't be running on the web, so I don't need to worry about preloading swfs since it will be running directly off a PC onto a screen in our office.

    Here is my code:
    Code:
    var myClips:Array = ["movie1.swf", "movie2.swf", "movie3.swf", "white_logo.swf"];
    
    var i:Number = 0;
    
    _root.container.onEnterFrame = function() {	
    	_root.loadMovie(myClips[i], "container");
    if (_root.container.child._currentframe==_root.container.child._totalframes){
    	_root.container.unloadMovie();
    	_root.loadMovie(myClips[i], "container");
    	_root.i = ++i;
    }
    }
    Last edited by RESlyder; 05-28-2010 at 04:27 PM.

  2. #2
    var x:Number = 1; x /= 0;
    Join Date
    Dec 2004
    Posts
    549
    I don't think "_root.container.child._currentframe" will work. I think you just need to use "_root.container._currentframe"

    also, change every place that you have "i" into "_root.i" and every "myClips" into "_root.myClips" within the onEnterFrame function there.

    I think that should work...try it.

    -Zippy Dee
    Ted Newman

  3. #3
    Member
    Join Date
    Aug 2006
    Posts
    96
    I ended up pushing this project to the back burner after posting. Recently picked it back up and figured out my issue, so I thought I would post the solution for anyone else looking.

    PHP Code:
    var myClips:Array = ["movie1.swf""movie2.swf""movie3.swf""movie4.swf"];

    var 
    i:Number 0;

    _root.container.loadMovie(myClips[i]);

    onEnterFrame = function(){
        if(
    _root.container._currentframe == _root.container._totalframes){
            ++
    i;
            
    _root.container.loadMovie(myClips[i]);
        }


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