A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Loading next un-named swf-movie

  1. #1
    Junior Member
    Join Date
    Sep 2016
    Posts
    3

    Loading next un-named swf-movie

    Hello.

    I hope someone can help me.
    I am using my old, trusty Flash Pro. 8 to create small movies to be shown on a couple of TV's in a bowling-alley!

    My idea was to just make a folder of movies that should be played in order (001.swf, 002.swf, 004.swf and so on).
    Now, I need an actionscript to load the next movie in nummeric order - similar to "loadMovieNum("002.swf", 0);", but without the actual name on the swf (002.swf).
    I need this because i want to be able to easily add and remove movies in the sequence without having to deeplink each movie to the next.
    Furthermore i should proberbly ad a "end-of-sequence" movie named 999.swf that points to the very first movie (named start.swf with loadMovieNum("002.swf", 0)

    Does that make sense?
    - and is it possible?

  2. #2
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    Create a text or XML file in the same folder that has a list of all the available SWF files in it and load that first. This way you don't need a special "end-of-sequence" SWF, you just load the list and then load the SWFs in whatever order you like.
    When your swf2exe tool just HAS to work
    there's only one choice... SWF Studio

  3. #3
    Junior Member
    Join Date
    Sep 2016
    Posts
    3
    Quote Originally Posted by Northcode View Post
    Create a text or XML file in the same folder that has a list of all the available SWF files in it and load that first. This way you don't need a special "end-of-sequence" SWF, you just load the list and then load the SWFs in whatever order you like.
    That sounds just about right! Can you help me with that code?

  4. #4
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    The AS2 code below will load the SWF files in the _root.swfs array one at a time and load the next one when the last frame is reached. When the last SWF in the list is finished, the first SWF will be loaded and the cycle will repeat.

    Code:
    _root.index = 0;
    _root.swfs = ["1.swf", "2.swf", "3.swf"];
    
    _root.createEmptyMovieClip("target", 0);
    _root.target.loadMovie(_root.swfs[_root.index]);	
    		
    _root.onEnterFrame = function()
    {
    	if (_root.target._totalframes > 0)
    	{
    		if (_root.target._currentframe == _root.target._totalframes)
    		{
    			_root.index = (_root.index+1)%swfs.length;
    			_root.target.loadMovie(_root.swfs[_root.index]);		
    		}
    	}
    }
    I leave the problem of loading the list of SWFs from a TXT or XML file into an array as an exercise for the reader...
    When your swf2exe tool just HAS to work
    there's only one choice... SWF Studio

  5. #5
    Junior Member
    Join Date
    Sep 2016
    Posts
    3
    Quote Originally Posted by Northcode View Post
    The AS2 code below will load the SWF files in the _root.swfs array one at a time and load the next one when the last frame is reached. When the last SWF in the list is finished, the first SWF will be loaded and the cycle will repeat.



    I leave the problem of loading the list of SWFs from a TXT or XML file into an array as an exercise for the reader...
    I was kindly asking for help, as I am not trained in AS2...

    In your solution I have to write every new movie I make - it was kinda what I would be without...?

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