2 Replies Latest reply on Apr 13, 2007 8:50 PM by Marcus_House

    Flash not reading colour correctfrom an external PNG? Bug? Or am I missing something?

      Hi guys and gals.
      I have a very interesting bug I think.. Wondering if there is a way around the problem I'm having.

      ok.. Very Very simply script here..

      Make new flash movie..
      On frame one.. put this code.


      (because I'm lazy and didnt put in loading detection... on frame 20 put this code.

      import flash.display.BitmapData;
      image_bitmap = new flash.display.BitmapData(r._width, r._height,false);
      curr_colour = this.image_bitmap.getPixel(5, 5); //0

      Now... make a simple image with the rgb colour 100,100,100 filled in it. (Mine is a simple 50x50 pixel image filled with that colour. save the png as "test.png" and put next to the fla with code above. You will see that the colour returned in the trace is not the hex value that matches color 100,100,100... it matches 99,99,99. Flash isnt reading the colour correctly...

      Now this same test returns the correct color and works fine if using a .gif or a .jpg. but I cannot do what I want with these formats. it must be a png.. .it must read the rgb value 100% correct every time and the image MUST be loaded from an external file.

      It seems that regardless the rgb is off by one. so if colour was 25,25,25 it would be returned as 24,24,24
      Is there any other way to do what I need to do.. or is there a bug in my code.. please anyone help.. I'm pulling my hair out with what should be a simple damn thing to do.