ScrollPane.getBytesLoaded()

Availability

Flash Player 6.0.79.

Edition

Flash MX 2004.

Usage

scrollPaneInstance.getBytesLoaded()

Parameters

None.

Returns

The number of bytes loaded in the scroll pane.

Description

Method; returns the number of bytes loaded in the ScrollPane instance. You can call this method at regular intervals while loading content to check its progress.

Example

This example creates an instance of the ScrollPane class called scrollPane. It then defines a listener object called loadListener with a progress event handler that calls the getBytesLoaded() method to help determine the progress of the load:

createClassObject(mx.containers.ScrollPane, "scrollPane", 0);
loadListener = new Object();
loadListener.progress = function(eventObj){  
  // eventObj.target is the component that generated the change event 
  var bytesLoaded = scrollPane.getBytesLoaded();
  var bytesTotal = scrollPane.getBytesTotal();
  var percentComplete = Math.floor(bytesLoaded/bytesTotal);
    
  if (percentComplete < 5 )  // loading just commences
  {        
    trace(" Starting loading contents from internet"); 
  } 
  else if(percentComplete = 50) //50% complete
  { 
    trace(" 50% contents downloaded "); 
  }
}
scrollPane.addEventListener("progress", loadListener);
scrollPane.contentPath = "http://www.geocities.com/hcls_matrix/Images/homeview5.jpg";