A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: _level Loader

  1. #1
    Senior Member
    Join Date
    Apr 2001
    Posts
    996

    _level Loader

    I have this loader set up but it won't recognize the level in order to get the bytesloaded and bytesTotal. I am sending the level as a parameter to the function
    Code:
    //====== Inital Level Loader ===============
    levelLoader = function (file, level) {
    	lev = "_level"+level;
    	loader_holder._x = 600.0;
    	loadMovieNum(file, level);
    	trace("LEV   :"+lev);
    	progressCheck.onEnterFrame = function() {
    		var percent = (lev.getBytesLoaded()/lev.getBytesTotal())*100;
    		if (!isNan(percent)) {
    			_root.loader_holder.bar._xscale = percent;
    		} else {
    			trace("0% loaded");
    		}
    		if (percent == 100 && lev.getBytesLoaded()>1) {
    			delete progressCheck.onEnterFrame;
    			loader_holder._x = 846.0;
    			trace("LEVEL: "+level+"      "+"IS FULLY LOADED");
    		}
    	};
    };
    levelLoader("squares.swf", 9);
    Why will this not work? The lev variable is not been read as a path but as a string. I have even used the [] operator to access the level but no joy. Can anyone help?

  2. #2
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    This one seems to work...

    Code:
    //====== Inital Level Loader ===============
    levelLoader = function (file, level) {
    	lev = "_level"+level;
    	loader_holder._x = 600.0;
    	loadMovieNum(file, level);
    	trace("LEV   :"+lev);
    	progressCheck.onEnterFrame = function() {
    		var percent = (this["_level"+level].getBytesLoaded()/this["_level"+level].getBytesTotal())*100;
    		//trace (percent);
    		//trace((this["_level"+level].getBytesLoaded()/this["_level"+level].getBytesTotal())*100);
    		if (!isNan(percent)) {
    			_root.loader_holder.bar._xscale = percent;
    		} else {
    		//trace(lev);
    			trace("0% loaded");
    		}
    		if (percent == 100) {
    			delete progressCheck.onEnterFrame;
    			loader_holder._x = 846.0;
    			trace("LEVEL: "+level+"      "+"IS FULLY LOADED");
    		}
    	};
    };
    levelLoader("ringB.swf", 9); // tried it with one of my files...

  3. #3
    Senior Member
    Join Date
    Apr 2001
    Posts
    996
    Ah nice one I tried everything but the right thing. Thanks
    YAAAAAAAA

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