| Package | net.guttershark.util |
| Class | public final class Bandwidth |
| Inheritance | Bandwidth flash.events.EventDispatcher |
import net.guttershark.managers.EventManager;
import net.guttershark.util.Bandwidth;
var bs:Bandwidth = new Bandwidth();
em.handleEvents(bs,this,"onBS");
bs.detect();
public function onBSComplete():void
{
trace(Bandwidth.Speed);
trace(Bandwidth.Speed==Bandwidth.HIGH);
trace(Bandwidth.Speed==Bandwidth.MED);
trace(Bandwidth.Speed==Bandwidth.LOW);
//Bandwidth.Speed will be equal to Bandwidth.LOW / MED / HIGH. One of the three.
}
See also
| Property | Defined by | ||
|---|---|---|---|
| contentLoader : URLLoader
The loader used to load the bandwidth image.
| Bandwidth | ||
| Speed : String = "null" [static]
Pointer to which bandwidth is detected.
| Bandwidth | ||
| Method | Defined by | ||
|---|---|---|---|
|
Bandwidth(image:URLRequest = null, targetLowBandwidth:Number = 256, targetMedBandwidth:Number = 550)
Constructor for Bandwidth instances.
| Bandwidth | ||
|
detect():void
Inititiates the bandwidth detection process.
| Bandwidth | ||
|
dispose():void
Dispose of internal variables.
| Bandwidth | ||
| Constant | Defined by | ||
|---|---|---|---|
| HIGH : String = "high" [static]
High bandwidth
| Bandwidth | ||
| LOW : String = "low" [static]
Low bandwidth
| Bandwidth | ||
| MED : String = "med" [static]
Medium bandwidth
| Bandwidth | ||
| contentLoader | property |
public var contentLoader:URLLoaderThe loader used to load the bandwidth image.
| Speed | property |
public static var Speed:String = "null"Pointer to which bandwidth is detected. Default is Bandwidth.MED
| Bandwidth | () | constructor |
public function Bandwidth(image:URLRequest = null, targetLowBandwidth:Number = 256, targetMedBandwidth:Number = 550)Constructor for Bandwidth instances.
Parametersimage:URLRequest (default = null) — The target KBps for low bandwidth.
|
|
targetLowBandwidth:Number (default = 256) — The target KBps for med bandwidth.
|
|
targetMedBandwidth:Number (default = 550) — This is an optional parameter - by default the sniffer loads a reference to
./bandwidth.jpg. You can pass a different URLRequest here to change what file
is used in the bandwidth detection.
The target high bandwidth is not a parameter because anything higher than the target medium bandwidth KBps will automatically be high. |
| detect | () | method |
public function detect():voidInititiates the bandwidth detection process.
| dispose | () | method |
public function dispose():voidDispose of internal variables.
| HIGH | constant |
public static const HIGH:String = "high"High bandwidth
| LOW | constant |
public static const LOW:String = "low"Low bandwidth
| MED | constant |
public static const MED:String = "med"Medium bandwidth