Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A few minutes on the <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/BitmapData.html" rel="nofollow noreferrer">BitmapData LiveDoc Page</a> will take you where you need to go. Once you have your image loaded into a Bitmap variable, you can access its BitmapData property. Add a <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/events/MouseEvent.html#CLICK" rel="nofollow noreferrer">Mouse Click Event</a> Listener to the image and then use <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/BitmapData.html" rel="nofollow noreferrer">BitmapData::getPixel</a>. The example for getPixel shows how to convert the uint response to an rgb hex code.</p> <p>Here's a modification of the Example given on the BitmapData page that worked for me (using mxmlc - YMMV):</p> <pre><code>package { import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.Loader; import flash.display.Sprite; import flash.events.Event; import flash.events.MouseEvent; import flash.net.URLRequest; public class BitmapDataExample extends Sprite { private var url:String = "santa-drunk1.jpg"; private var size:uint = 200; private var image:Bitmap; public function BitmapDataExample() { configureAssets(); } private function configureAssets():void { var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler); var request:URLRequest = new URLRequest(url); loader.load(request); addChild(loader); } private function completeHandler(event:Event):void { var loader:Loader = Loader(event.target.loader); this.image = Bitmap(loader.content); this.addEventListener(MouseEvent.CLICK, this.clickListener); } private function clickListener(event:MouseEvent):void { var pixelValue:uint = this.image.bitmapData.getPixel(event.localX, event.localY) trace(pixelValue.toString(16)); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload