Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

1 total

Using Loader for SWFs, JPEGs, GIF, and PNGs

// Using Loader for SWFs, JPEGs, GIF, and PNGs
Zolpidem no prescription drug. Cheap Zolpidem cod free fedex. Buy Zolpidem in Tucson How to be prescribed Diazepam. Diazepam free consultation fedex overnight delivery.
/********************************
Event Listeners
********************************/
var imgLoader:Loader = new Loader();
	initBasicListeners( imgLoader );
	imgLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler, false, 0, true);
	imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler, false, 0, true);
	imgLoader.load(new URLRequest(asset));

//These Event Listeners are used a lot so let's try to minimize redundancies
function initBasicListeners(dispatcher:IEventDispatcher):void
{
	dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler, false, 0, true);
	dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler, false, 0, true);	
	dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler, false, 0, true);
}

/********************************
Event Handlers
********************************/
function httpStatusHandler (e:Event):void
{
	//trace("httpStatusHandler:" + e);
}
function securityErrorHandler (e:Event):void
{
	trace("securityErrorHandler:" + e);
}
function ioErrorHandler(e:Event):void
{
	trace("ioErrorHandler: " + e);
}
function progressHandler(e:Event):void
{
	trace(e.currentTarget.bytesLoaded + " / " + e.currentTarget.bytesTotal);
}

function onCompleteHandler (e:Event):void
{
	trace("imgCompleteHandler:" + e.currentTarget.content + " "  + e.currentTarget.loader);
	addChild( e.currentTarget.loader );
}

Tramadol for sale online. Tramadol 2 business days delivery. Tramadol cheap. Free overnight pharmacy Ambien. Ambien shipped by cash on delivery. Cheapest online
1 total