A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: partially disappearing dynamic loaded images

Threaded View

  1. #1
    Angkor-What? Gekke_Hollander's Avatar
    Join Date
    Jun 2000
    Location
    Netherlands
    Posts
    234

    partially disappearing dynamic loaded images

    Problem solved...

    Code:
    /// start vars loading
    var varsLoaded = false;
    var mainTimeline = _root;
    varSender = new LoadVars();
    varSender.cacheKiller = new Date().getTime();
    varReceiver = new LoadVars();
    varReceiver.onLoad = function (success) 
    {
      if (success)
      	{
    		//x.cc_status.text += (this.total);
    		varsLoaded = true;
    	} else {
    		//clearInterval(varPreloader);
    	    mainTimeline.cc_status.text = "load failed!"
    	}
    }
    //varPreloader = setInterval(checkVarStatus,100);
    
    function checkVarStatus () {
      var kbLoaded = Math.floor(varReceiver.getBytesLoaded()/1024);
      var kbTotal = Math.floor(varReceiver.getBytesTotal()/1024);
      if (kbTotal == undefined)
      	{
        kbTotal = "???";
      	}
      mainTimeline.cc_status.text = kbLoaded + " / " + kbTotal + "Kb";
    }
    
    varSender.loaddirectory = "commissions";
    varSender.sendAndLoad("load.php", varReceiver, "POST");
    
    /// start jpg loading
    
    MovieClip.prototype.loadjpg = function(picName, holderName)
    	{
    		var h = holderName;
    		this.createEmptyMovieClip(h, count);
    		//this._visible = false;  
    		this[h].loadMovie(picName);  
    		this[h]._alpha = 100;  
    		this.onEnterFrame = function()  
    								{
    									if (this[h]._width > 0)  
    										{
    											this._alpha = 99; 
    											delete this.onEnterFrame;
    											this._visible = true; 
    											this.cc_status._visible = false;
    											this[h].onComplete = _global.onComplete(this[h]);
    										}
    									else
    										{
    											ff = getTimer()/1000;
    											if((getTimer()/1000)-ff > 1)  // don't show progress if time to load is less than a sec
    											{
    												this.cc_status._visible = true;
    											}
    											this[h].onLoading = _global.onLoading(this[h]);
    										}
    								}
    	};
    
    _global.onLoading = function(what)
    				{
    		        if(what.getBytesLoaded())
    					{
    						what._parent.cc_status.text = Math.round((what.getBytesLoaded()/1024))+"/"+Math.round((what.getBytesTotal()/1024))+"Kb"
                		    //what._parent.cc_status.text += " | "+Math.round(what.getBytesLoaded()/what.getBytesTotal()*100)+"%";
    			        }
    				}
    _global.onComplete = function(what)
    				{
    				what._parent.cc_status.text = Math.round((what.getBytesLoaded()/1024))+"/"+Math.round((what.getBytesTotal()/1024))+"Kb"
           		    //what._parent.cc_status.text += " | "+Math.round(what.getBytesLoaded()/what.getBytesTotal()*100)+"%";
    				for (var mc in what._parent)
    					{
    			              if (what._parent[mc] != what) 
    							{
    //					trace(what._parent[mc]);
    //					trace(what.getDepth());
    								what._parent[mc]._visible = false;
    	    	    	        }
    					}
    					
    					what._x = (offWw-what._width)/2;
    					what._y = (offWh-what._height)/2;
    					canLoad = true;
    				};
    				
    x = createEmptyMovieClip("bigholder",1);
    x.createTextField("cc_status", -1, 0, 0, 300, 20);
    x.cc_status._visible = false;
    x._x = 40;
    x._y = 40;
    var offWw = 500;
    var offWh = 500;
    var canLoad = true;
    var count = -1;
    datum = new Date();
    
    function CC_fwdJPG()
    	{	
    		if(count+1<varReceiver.total && varsLoaded == true && canLoad == true)
    			{
    				canLoad = false;
    				count++;
    				plaatje = "jpg.php?folder="+varReceiver.imgfolder+"&file="+varReceiver["img"+count]+"&"+datum.getTime();
    				x.loadjpg(plaatje, "smallholder"+count);
    			}
    					root.count = count;
    	}
    
    function CC_bckJPG()
    	{
    		if(count-1>=0 && varsLoaded == true && canLoad == true)
    			{
    				canLoad = false;
    				count--;
    				plaatje = "jpg.php?folder="+varReceiver.imgfolder+"&file="+varReceiver["img"+count]+"&"+datum.getTime();
    				x.loadjpg(plaatje, "smallholder"+count);
    			}
    					root.count = count;
    	}
    	
    load_btn.onRelease = CC_fwdJPG;
    load_btn2.onRelease = CC_bckJPG;
    Last edited by Gekke_Hollander; 04-06-2004 at 05:06 PM.
    MX 2004 Pro - Oops I did it again!!!
    SWF, it's a journey... not a destination

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