Comunidad de diseño web y desarrollo en internet online

cargar mc en forma aleatoria desde la biblioteca

Citar            
MensajeEscrito el 13 Sep 2009 03:04 pm
es que no se como resolver un problema de cargar aleatoriamente 9 mc distintos que tengo en la biblioteca:

Código ActionScript :

this.attachMovie("LAGRIMA1","LAGRIMA1",this.getNextHighestDepth());
LAGRIMA1._x=60;
LAGRIMA1._y=240;
this.attachMovie("LAGRIMA2","LAGRIMA2",this.getNextHighestDepth());
LAGRIMA2._x=157.5;
LAGRIMA2._y=190;
this.attachMovie("LAGRIMA3","LAGRIMA3",this.getNextHighestDepth());
LAGRIMA3._x=255;
LAGRIMA3._y=240;
this.attachMovie("LAGRIMA4","LAGRIMA4",this.getNextHighestDepth());
LAGRIMA4._x=352.5;
LAGRIMA4._y=190;
this.attachMovie("LAGRIMA5","LAGRIMA5",this.getNextHighestDepth());
LAGRIMA5._x=450;
LAGRIMA5._y=240;
this.attachMovie("LAGRIMA6","LAGRIMA6",this.getNextHighestDepth());
LAGRIMA6._x=547.5;
LAGRIMA6._y=190;
this.attachMovie("LAGRIMA7","LAGRIMA7",this.getNextHighestDepth());
LAGRIMA7._x=645;
LAGRIMA7._y=240;
this.attachMovie("LAGRIMA8","LAGRIMA8",this.getNextHighestDepth());
LAGRIMA8._x=742.5;
LAGRIMA8._y=190;
this.attachMovie("LAGRIMA9","LAGRIMA9",this.getNextHighestDepth());
LAGRIMA9._x=840;
LAGRIMA9._y=240;

asi los cargo, son 9 lagrimas que se convierten en botones, pero todas bajan al mismo tiempo, juntas y en orden, lo que quiero hacer es que varie el orden cada determinado tiempo.RANDOM

[BOFH]Cuando escribas código ActionScript, enciérralo entre las etiquetas [*as] y [*/as] (sin los asteriscos). The Fricky![/BOFH]

Por JIMMYTHECLOWN

25 de clabLevel



 

MÉXICO

msie8
Citar            
MensajeEscrito el 16 Sep 2009 04:03 am
ayuda de alguien

Por JIMMYTHECLOWN

25 de clabLevel



 

MÉXICO

msie8
Citar            
MensajeEscrito el 16 Sep 2009 12:04 pm
Empieza usando un loop

Código ActionScript :

for(var i:Number = 1; i<10; i++)
 this.attachMovie("LAGRIMA1","LAGRIMA"+i,this.getNextHighestDepth(), {_x:Math.random()*Stage.width, _y:Math.random()*Stage.height}); 


Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 17 Sep 2009 02:15 am
GRACIAS pero lo quiero qu hagan lo botones es que tomen el el lugar que les designe pero que comiencen en diferentes tiempos de forma aleatoria son 9 diferentes mc

Por JIMMYTHECLOWN

25 de clabLevel



 

MÉXICO

msie8
Citar            
MensajeEscrito el 17 Sep 2009 10:38 am
Si la animación es estática (en la línea de tiempo) entonces solo puedes hacer un gotoAndPlay, aunque eso variará su posición, prueba esto:

for(var i:Number = 1; i<10; i++)
this["LAGRIMA"+i].gotoAndPlay(int(Math.random()*25)+1)

Reemplaza 25 por el total de frames que tenga la animación del movimiento

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 19 Sep 2009 01:43 am
no lo he podido solucionar y ahora hice esto para acomodar mis nueve botones:

Código ActionScript :

 
this.attachMovie("LAGRIMA","LAGRIMA",this.getNextHighestDepth());
LAGRIMA._x=60;
LAGRIMA._y=240;
var num:Number=9;
var dirY:Number=0
var col:Number=2
for(i=1;i<num;i++){
   LAGRIMA.duplicateMovieClip("LAGRIMA"+i,this.getNextHighestDepth());
   _root["LAGRIMA"+i]._x=(LAGRIMA._width-2.5)*i+LAGRIMA._x;
   _root["LAGRIMA"+i]._y=50*dirY+LAGRIMA._y-50;
   dirY++;
   if (dirY==col){
      dirY=0
   }
} 

pero no he conseguido que inicien en forma aleatoria, osea con math.random
alguien me podria ayudar?
mi sitio es http://www.bahaisdexalapa.com/

Por JIMMYTHECLOWN

25 de clabLevel



 

MÉXICO

msie8
Citar            
MensajeEscrito el 21 Sep 2009 10:41 am
Si la animación es en línea de tiempo, ponle un stop en el primer fotograma y agrega esto

Código ActionScript :

var t = setInterval(function(w){
   w.play()
   clearInterval(t)
}, Math.random()*1000, this)


Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox

 

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