topical media & game development
actionscript-omr-lib-Glyph.ax
actionscript-omr-lib-Glyph.ax
[swf]
flex
package
{
import flash.display.Bitmap;
import flash.events.*;
import flash.net.URLRequest;
import flash.display.Loader;
public class @ax-actionscript-omr-lib-Glyph
{
private var loader:Loader;//loader for loading in images
private var bitMapBg:Bitmap
public function @ax-actionscript-omr-lib-Glyph()
{
//import symbolpictures
//make dynamic 'learning' algorithms
// bitMapBg = new Bitmap();
loadBgImage("this/url/string");
}
public function getQuaver():Bitmap{
return bitMapBg;
}
//load the image
private function loadBgImage(imageURL:String):void {
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
//loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onIOErrorHandler);
//loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);
var request:URLRequest = new URLRequest(imageURL);//access our array of url's
loader.load(request);
}
private function loaded(event:Event):void {
//dispatch the loaded event
//dispatchEvent(new Event(FullBrowserBg.BG_LOADED, true));
bitMapBg = Bitmap(loader.content);//get the loaders content as a bitmap
//remove the eventListeners on the loader object and set it to null
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, loaded);
//loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onIOErrorHandler);
//loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, progressHandler);
loader = null;
}
}
}
(C) Æliens
27/08/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.