actionscript-misc-BitmapLoader.ax [swf] flex
package { import flash.display.*; import flash.events.*; import flash.net.*; // A simple example showing how to load an image. public class @ax-actionscript-misc-BitmapLoader extends Sprite { private var loader:Loader; // The bitmap loader public function @ax-actionscript-misc-BitmapLoader() { // Create the loader loader = new Loader(); // Wait for the bitmap to load and initialize loader.contentLoaderInfo.addEventListener(Event.INIT, initListener); // Load the bitmap loader.load(new URLRequest("actionscript-misc-assets-photo.jpg")); } private function initListener (e:Event):void { // Add loaded asset to display list addChild(loader.content); // Retrieve the color value for // the top-left pixel in the loaded bitmap trace(Bitmap(loader.content).bitmapData.getPixel(0, 0)); } } }
(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.