Cargar imagen externa con loadMovie de flash
Aquí os pongo una función que suelo usar para cargar imagenes externas a flash.
Con esta función puedes mostrar la precarga y también sirve para cargar, a parte de jpgs, swf.
Pues nada, aquí esta el codigo:
- function cargar_imagen(nombre_clip, ruta_imagen) {
- this.createEmptyMovieClip(nombre_clip, 5);
- this[nombre_clip].loadMovie(ruta_imagen, 9);
- this.onEnterFrame = function() {
- if (this[nombre_clip].getBytesTotal()>50 && this[nombre_clip].getBytesLoaded()>=this[nombre_clip].getBytesTotal()) {
- this[nombre_clip]._width=300;
- this[nombre_clip]._height=250;
- delete this.onEnterFrame;
- } else {
- tot = this.getBytesTotal();
- car = this.getBytesLoaded();
- por = Math.round(car*100/tot);
- porcentaje.text = por+” %”;
- }
- };
- }
- cargar_imagen(carga_foto, “http://www.mundofotos.net/imatges/23_02_2006/amn19821140651600.jpg”);
Ejemplo:
This movie requires Flash Player 8
10 comments November 8th, 2006