A ver si alguien puede ayudarme a solucionar una duda que tengo.
Tengo una web creada en flash en la que cargo imágenes dinámicamente, el problema es que no se como aplicar la clase BitmapData para poder darle suavizado y que no se rateen estas imágenes.
El problema es que cargo las imagenes con el siguiente código:
Código :
miFormato = new TextFormat(); miFormato.font = "Arial"; miFormato.size = 50; miFormato.color = 0x222222; MovieClip.prototype.loadjpg = function(contenedor, img, xPos, yPos, profundidad,ancho,alto) { delete this[contenedor]; this.createEmptyMovieClip(contenedor, profundidad); this.createTextField("textoPreloader", profundidad+1000, xPos, yPos, 70, 53); this.textoPreloader.setNewTextFormat(miFormato); this[contenedor].loadMovie(img); this.onEnterFrame = function() { this.porcentaje = (this[contenedor].getBytesLoaded()/this[contenedor].getBytesTotal())*99; if (!isNaN(this.porcentaje)) { this.textoPreloader.text = Math.round(this.porcentaje); this.textoPreloader._x=5; this.textoPreloader._y=-5; } else { this[contenedor].stop(); this.textoPreloader.text = "0"; } if ((this.porcentaje == 99) && (this[contenedor]._width>0)) { this[contenedor]._x = xPos; this[contenedor]._y = yPos; this[contenedor]._width=ancho; this[contenedor]._height=alto; this.textoPreloader.removeTextField(); delete this.onEnterFrame; } else { //si aun no está cargado stop(); this.stop(); } }; };
Asi cada vez que quiero cargar una imagen dentro de un contenedor, solo debo añadir:
Código :
clipcontiene.loadjpg("clipcontiene","imagenes/news.jpg", 0, 0, 1,154,99);
por ejemplo.
El caso es que he leido todo acerca de la clase BtmapData y despues de varios intentos no consigo añadirla al código primero. He probado lo siguiente y nada.
Código :
miFormato = new TextFormat(); miFormato.font = "Arial"; miFormato.size = 50; miFormato.color = 0x222222; MovieClip.prototype.loadjpg = function(contenedor, img, xPos, yPos, profundidad,ancho,alto) { delete this[contenedor]; this.createEmptyMovieClip(contenedor, profundidad); var bmpData1:BitmapData=new BitmapData (ancho, alto, false , 0xaa3344); this[contenedor].attachBitmap (bmpData1, profundidad+2000, "auto", true); this.createTextField("textoPreloader", profundidad+1000, xPos, yPos, 70, 53); this.textoPreloader.setNewTextFormat(miFormato); this[contenedor].loadMovie(img); this.onEnterFrame = function() { this.porcentaje = (this[contenedor].getBytesLoaded()/this[contenedor].getBytesTotal())*99; if (!isNaN(this.porcentaje)) { this.textoPreloader.text = Math.round(this.porcentaje); this.textoPreloader._x=5; this.textoPreloader._y=-5; } else { this[contenedor].stop(); this.textoPreloader.text = "0"; } if ((this.porcentaje == 99) && (this[contenedor]._width>0)) { this[contenedor]._x = xPos; this[contenedor]._y = yPos; this[contenedor]._width=ancho; this[contenedor]._height=alto; this.textoPreloader.removeTextField(); delete this.onEnterFrame; } else { //si aun no está cargado stop(); this.stop(); } }; };
Alguien que me ayude, por favor.
Gracias.