Comunidad de diseño web y desarrollo en internet online

Creación dinámica de peliculas. Solo funciona una vez.

Citar            
MensajeEscrito el 09 May 2005 10:52 pm
Hola soy nuevo, de Costa Rica.
Tengo un problema con una clase en actionscript 1.0

Código :

var myRoot = _root;

//este array lleva la cuenta de cuales ventanas estan abiertas
openWindows_array = new Array();

//clase que crea una ventana a partir de un componente propio
function TextViewer(textViewerTitle){
   this.textViewerTitle = textViewerTitle;
   this.tvName = "myTextViewer_" + parseFloat(myRoot.ventanasAbiertas_array.length + 1);
   myRoot.createEmptyMovieClip(this.tvName, 0);
      myRoot[this.tvName]._x = 0;
      myRoot[this.tvName]._y = 0;
      myRoot[this.tvName].attachMovie("neWindowComponent", "textViewerWindow", 0, {theTitle: this.textViewerTitle, theHeight: 350, theWidth: 200, textColor: "000000", firstColor: "-663794", secondColor: "940A-FF"});
   myRoot.openWindows_array.push(this.tvName);
}

firstWindow = new TextViewer("Primera ventana");
secondWindow = new TextViewer("Segunda ventana");
thirdWindow = new TextViewer("Tercera ventana");


El problema es que solo me crea el ultimo objeto "thirdWindow".

¿alguna idea?

Por Emaus

1 de clabLevel



 

msie
Citar            
MensajeEscrito el 10 May 2005 02:32 am
en el attach metes todos los clips al mismo nivel

Por fael

BOFH

2443 de clabLevel

3 tutoriales
2 articulos

 

firefox
Citar            
MensajeEscrito el 10 May 2005 09:27 pm
Gracias, eso solucionó el problema.

Código :

var myRoot = _root;
openWindows_array = new Array();

function TextViewer(textViewerTitle){
   this.textViewerTitle = textViewerTitle;
   this.tvName = "myTextViewer_" + parseFloat(myRoot.openWindows_array.length + 1);
   this.tvLevel = myRoot.openWindows_array.length + 1;
   myRoot.openWindows_array.push(this.tvName);
   trace("El nivel está definido en: " + this.tvLevel);
   myRoot.createEmptyMovieClip(this.tvName, this.tvLevel);
   myRoot[this.tvName]._x = 0;
   myRoot[this.tvName]._y = 0;
   myRoot[this.tvName].attachMovie("neWindowComponent", "textViewerWindow", 0, {theTitle: this.textViewerTitle, theHeight: 350, theWidth: 200, textColor: "000000", firstColor: "-663794", secondColor: "940A-FF"});
   trace("La profundidad es de: " + myRoot[this.tvName].getDepth());
   trace("Mi nombre es: " + myRoot[this.tvName]._name);
}

firstWindow = new TextViewer("Primera ventana");
secondWindow = new TextViewer("Segunda ventana");
thirdWindow = new TextViewer("Tercera ventana");


Sin embargo me gustaría que alguien me explicara la diferencia entre "level" y "depth" de modo tal que pueda solucionar un problema de swapDepths que tengo.

Saludos:

Emaus.

Por Emaus

1 de clabLevel



 

msie
Citar            
MensajeEscrito el 11 May 2005 08:03 am
En los levels cargas las cosas externas, en los depths controlas la altura de los clips. Por ejemplo:

Crea un archivo que se llame circ3.fla y en el crea un movieclip llamado circ3_mc y pon este código en el primer fotograma.

Código :

trace("Clip " + circ3_mc + " en profundidad " + circ3_mc.getDepth());


Grábalo, haz Ctrl+Intro para ver lo que te saca, debería sacarte esto por el OutPut.

Código :

Clip _level0.circ3_mc en profundidad -16383


Ahora crea otro archivo .fla, llamalo como quieras y en el pon un movieclip que se llame circ_mc. En la biblioteca, en las propiedades de vinculación que se llame "circ", y luego pon este código en el primer fotograma.

Código :

trace("Clip " + circ_mc + " en profundidad " + circ_mc.getDepth());

attachMovie("circ", "circ2_mc", 1);
trace("Clip " + circ2_mc + " en profundidad " + circ2_mc.getDepth());

loadMovie("circ3.swf", 2);


Grábalo y haz Ctrl+intro para ver que te saca. Debería sacarte esto por el OutPut.

Código :

Clip _level0.circ_mc en profundidad -16383
Clip _level0.circ2_mc en profundidad 1
Clip _level2.circ3_mc en profundidad -16383


Como puedes ver, el clip que hay en el escenario está en el level 0 y en la profundidad -16838, el que has importado desde la biblioteca dinámicamente está en el level 0 al pertenecer a la misma película pero en la profundidad 1 porque es la que le has asignado tú, y por último, el swf que importas dinámicamente está en el level 2 al pertenecer a otra película y en la profundidad -16383 al no haberlo importado dinámicamente desde la biblioteca.

Ala, deu!!

Por Elecash

Claber

8126 de clabLevel

37 tutoriales
19 articulos
13 ejemplos

  Bastard Operators From Hell Desarrollador de GAIA Premio_Secretos Héroes

BarnaCity

clabbrowser

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.