+ Reply to Thread
Results 1 to 1 of 1

How to get each url from xml file.

This is a discussion on How to get each url from xml file. within the Flash English forums, part of the Flash CS3 - CS4 - CS5 category; Hi, Flep, I m in a problem, i have 3-4 swfs, those i m trying to load all these swfs ...

  1. #1
    Junior Member Settled In gauravS is on a distinguished road
    Join Date
    Aug 2008
    Posts
    4
    Rep Power
    0

    How to get each url from xml file.

    Hi, Flep,

    I m in a problem, i have 3-4 swfs, those i m trying to load all these swfs from an xml file, Every thing works fine when i load it without for loop,but when i try to load it with for loop, i am able to load always last swf from xml file. For a demo purpose i m doing everything in fla file and not class base. xml file structure is like this ,

    HTML Code:
    <thumbnails>
      <thumbnail filename="1.swf"/>
      <thumbnail filename="2.swf"/>
      <thumbnail filename="3.swf"/>
    </thumbnails>
    and main file's code is this
    Code:
    var url_:String="file.xml";
    var loader:URLLoader;
    var ld:Loader;
    var xml:XML;
    var mc:MovieClip = new MovieClip();
    var xmlist:XMLList;
    var arr2:Array = new Array();
    var arr:Array = new Array();
    loader=new URLLoader(new URLRequest(url_));
    loader.addEventListener(Event.COMPLETE, onC);
    function onC(e:Event)
    {
    	var loader:URLLoader=e.target as URLLoader;
    	xml=new XML(loader.data);
    	xmlist=xml.thumbnail;
    	for each (var item:* in xmlist)
    	{
    		arr.push(item.attribute("filename"));
    
    	}
    	
    	for(var i:uint=0; i<arr.length; i++)
    	{
    		ld = new Loader();
    		ld.contentLoaderInfo.addEventListener(Event .COMPLETE , swfDidLoad);
    		ld.name = "ld" + i;
    		
    		addChild(ld);
    	
    		function swfDidLoad(e:Event)
    		{
    			mc=e.target.content as MovieClip;
    
    			
    			mc.addEventListener(Event.ENTER_FRAME, go);
    		}
    		function go(e:Event)
    		{
    
    			if (e.target.currentFrame==e.target.totalFrames)
    			{
    				//trace("hi done");
    				e.target.removeEventListener(Event.ENTER_FRAME, go);
    			}
    		}
    	}
    
    }




    See if you can give me any idea for getting all thee swfs one by one.
    Attached Files
    Last edited by Flep; 05-05-10 at 13:50. Reason: added CODE tags

+ Reply to Thread

Similar Threads

  1. Replies: 1
    Last Post: 24-06-09, 08:30
  2. Replies: 4
    Last Post: 29-11-08, 07:42
  3. loading external text file in nested flash file
    By angel3m in forum HELP free utilities
    Replies: 0
    Last Post: 16-07-08, 21:18
  4. Applicare un file .as esterno ad un file .fla
    By jseeker in forum Actionscript 3.0 base
    Replies: 1
    Last Post: 09-07-08, 12:06

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts