Totalmente de acuerdo con la soluci�n de Joseba. Pero personalmente
suelo evitar tener que cargar im�genes externas y hacer un
redimensionado de tama�o. A esto le veo un par de problemillas: 
   � el pixelado excesivo que sufren las im�genes en flash cuando se
var�a su tama�o.
   � En el caso de cargar una imagen m�s grande de lo necesario estamos
generando un tr�fico tambi�n innecesario.


Mi granito de arena...
Xavi Beumala
http://www.code4net.com

> -----Mensaje original-----
> De: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] En nombre de Joseba Alonso
> Enviado el: martes, 21 de octubre de 2003 17:49
> Para: [EMAIL PROTECTED]
> Asunto: Re: [ASNativos] novato creando clases
> 
> 
> no, con loadMovie pides que cargue la imagen, pero es una 
> operacion asincrona, esto es, la accion no se ejecuta 
> inmediatamente sino que ocurre en un tiempo no determinado. 
> Puedes utilizar un peque�o preloader para comprobar cuando la 
> imagen ha cargado realmente y entonces aplicar la redimension.
> 
> algo asi:
> 
> <code>
> _global.Imagen = function(nombre, x, y, w, h) {
>  this.x = x;
>  this.y = y;
>  this.w = w;
>  this.h = h;
>  this.nombre = nombre;
>  this.clip = null;
>  this._int = null;
> };
> Imagen.prototype.cargar = function(mc, prof) {
>  this.clip = mc.createEmptyMovieClip("tHolder"+prof, prof);  
> this.clip.loadMovie(this.nombre, prof);  this.clip._x = 
> this.x;  this.clip._y = this.y;  this.clip.instancia = this;  
> this.clip._alpha = 0;  clearInterval(this._int);  this._int = 
> setInterval(this,"_comprobar",100);
> 
> };
> Imagen.prototype._comprobar = function(){
> 
> if(this.clip.getBytesLoaded()==this.clip.getBytesTotal()&&this
> .clip.getBytes
> Loaded()>0){
>   this.redimensionar();
>   this.clip._alpha = 100;
>   clearInterval(this._int);
>  }
> }
> Imagen.prototype.redimensionar = function(){
>  this.clip._width = this.w;
>  this.clip._height = this.h;
> }
> </code>
> 
> 
> un saludo
> 
> Joseba Alonso
> www.sidedev.net
> ----- Original Message ----- 
> From: "ugly-naked" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, October 21, 2003 4:44 PM
> Subject: Re: [ASNativos] novato creando clases
> 
> 
> gracias Joseba
> 
> te refieres a esto?
> 
> <code>
> Imagen.prototype.cargar = function(mc, prof) {
> this.clip = mc.createEmptyMovieClip("tHolder"+prof, prof); 
> this.clip.instancia = this; this.clip.loadMovie(this.nombre,prof);
> this.clip._x = this.x;
> this.clip._y = this.y;
> this.clip._width = this.w;
> this.clip._height = this.h;
> };
> </code>
> 
> espero q no, pq sigue sin funcionar :(
> 
> gracias por tu tiempo
> 
> saludos
> 
> ----- Mensaje Original -----
> De: "Joseba Alonso" <[EMAIL PROTECTED]>
> Fecha: Martes, Octubre 21, 2003 3:43 pm
> Asunto: Re: [ASNativos]  novato creando clases
> 
> > Yo veo 2 cosas:
> >
> > 1)
> >
> > this.loadMovie(this.nombre,prof);
> >
> > deberia ser:
> > this.clip.loadMovie(this.nombre,prof);
> >
> > 2)
> >
> > No apliques la redimension hasta que hayas cargado la foto.
> >
> > un saludo
> >
> > Joseba Alonso
> > www.sidedev.net
> > ----- Original Message -----
> > From: "ugly-naked" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Tuesday, October 21, 2003 10:56 AM
> > Subject: [ASNativos] novato creando clases
> >
> >
> > hola,
> >
> > estoy empezando con esto de las clases y me he basado 
> (bueno, m�s bien 
> > lo he copiado y he ido modificando) en un minitutorial de 
> Joseba para 
> > hacer botones din�micamente.
> >
> > lo q quiero es una clase para cargar jpgs indic�ndoles el nombre, 
> > tama�o y en q posici�n deben cargarse. la verdad es q estoy 
> demasiado 
> > pez, os pongo el c�digo por si alguno me puede dar algo de luz
> >
> > <code>
> >
> > _global.Imagen = function(nombre, x, y, w, h) {
> > this.width = 83;
> > this.height = 100;
> > this.x = x;
> > this.y = y;
> > this.w = w;
> > this.h = h;
> > this.nombre = nombre;
> > this.clip = null;
> > };
> >
> > Imagen.prototype.cargar = function(mc, prof) {
> > this.clip = mc.createEmptyMovieClip("tHolder"+prof, prof); 
> > this.clip._x = this.x; this.clip._y = this.y;
> > this.clip._width = this.w;
> > this.clip._height = this.h;
> > this.clip.instancia = this;
> > this.loadMovie(this.nombre,prof);
> > };
> >
> > </code>
> >
> > y luego la llamo
> >
> > <code>
> >
> > var img = new Imagen("imagen1.jpg",10,10,83,100);
> > img.cargar(_root,1);
> >
> > </code>
> >
> > gracias
> >
> >
> > <!-------------------------------
> > Lista ASNativos:
> > subscripciones/desubscripciones
> > http://www.sidedev.ne
> > -------------------------------->
> >
> > <!-------------------------------
> > Lista ASNativos:
> > subscripciones/desubscripciones
> > http://www.sidedev.ne
> > -------------------------------->
> >
> 
> 
> <!-------------------------------
> Lista ASNativos:
> subscripciones/desubscripciones http://www.sidedev.net/asnativos
> -------------------------------->
> 
> <!-------------------------------
> Lista ASNativos:
> subscripciones/desubscripciones http://www.sidedev.net/asnativos
> -------------------------------->
> 

<!-------------------------------
Lista ASNativos:
subscripciones/desubscripciones
http://www.sidedev.net/asnativos
-------------------------------->

Responder a