SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru whisher's Avatar
    Join Date
    May 2006
    Location
    Kakiland
    Posts
    732
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    As 2 Preloader for dynamically loaded images

    Hi.
    I'm trying to put up a simple
    gallery but I don't manage
    to handle a preloader.
    I mean I'd like to get the
    total images size to attach
    to it a preloader and in actual
    fact I'm not sure to follow the
    right way
    so the code:
    Code Actionscript:
    var images:Array = [];
    var descriptions:Array = [];
    var totalItems:Number = 0;
    function parseXMLData(success:Boolean):Void {
    	if (success && this.status == 0) {
    		var xmlNode = this.firstChild;
    		totalItems = xmlNode.childNodes.length;
    		for (var i = 0; i<totalItems; i++) {
    			images[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
    			descriptions[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
    		}
    		init();
    	} else {
    		trace("Problem loading file xml");
    		trace("The error code is "+this.status);
    	}
    }
    function init() {
    	loader();
    }
    function loader():Void {
    	var loadListener:Object = new Object();
    	loadListener.onLoadComplete = function(target_mc:MovieClip, httpStatus:Number):Void {
       	}
    	loadListener.onLoadInit = function(target_mc:MovieClip):Void {
      		trace(target_mc.getBytesTotal());    
    	}
    	for (var i = 0; i<totalItems; i++) {
    		var mcLoader:MovieClipLoader = new MovieClipLoader();
    		mcLoader.addListener(loadListener);
    		var mc:MovieClip = this.createEmptyMovieClip('mc_'+i, this.getNextHighestDepth());
    		mcLoader.loadClip(images[i], mc);
    		//_root['mc_'+i]._x = 10*i;
    	}
    }
    var xmlData:XML = new XML();
    xmlData.ignoreWhite = true;
    xmlData.load("gallery.xml");
    xmlData.onLoad = parseXMLData;
     
    //_root["particle"+j+"_mc"]._x = _xmouse;

    Can you help me , please ?


    Bye.

  2. #2
    SitePoint Member
    Join Date
    Sep 2009
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Arrow

    Hi there,

    I would suggest you to take a look at sources of free flash preloader component.
    You may whether use actionscript classes offered as open source or use preloader as a built-and-ready component - which is pretty simple to use.

    site: www preloaderz com (that's my first post here, so I can't post the links )


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
  •