Color de un pixel con bitmapdata y getPixel()
March 23rd, 2007
Hoy os pongo una función para que podais saber el color de un píxel de una imagen cargada con la clase Bitmapdata. No he comentado el código, pero si teneis alguna duda sobre él escribirme un mail o ponedlo en los comentarios.
Este es el codigo:
- import flash.display.*;
- cargar_imagen_bitmapdata(”http://www.forosdeflash.com/blog/wp-content/ferran1129050413.jpg”);
- function cargar_imagen_bitmapdata(imagen) {
- original = _root.createEmptyMovieClip(”original”, _root.getNextHighestDepth());
- original._y = 20;
- cargando = new Object();
- cargando.onLoadInit = function() {
- w = original._width;
- h = original._height;
- bmpData1 = new BitmapData(w, h, true, 0×000000);
- bmpData1.draw(original);
- original.attachBitmap(bmpData1, 2, “auto”, true);
- color.text = (”Color del pixel 10,10 : 0x”+bmpData1.getPixel(10, 10).toString(16));
- };
- imagen_mcl = new MovieClipLoader();
- imagen_mcl.addListener(cargando);
- imagen_mcl.loadClip(imagen, original);
- }
Ejemplo:
This movie requires Flash Player 8
Entry Filed under: ActionScript
2 Comments Add your own
1. meneame.net&hellip | April 5th, 2007 at 20:39
Color de un pixel con bitmapdata y getPixel()…
pequeño tutorial/manual para crear una función para que podais saber el color de un píxel de una imagen cargada con la clase Bitmapdata con actionscript de flash….
2. Medvith | August 2nd, 2007 at 20:17
se abres color_de_un_pixel.swf un error ocurre… pero se testas el .fla no hay error… como se pode mudar eso?
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed