Comunidad de diseño web y desarrollo en internet online

Dos attachMovie

Citar            
MensajeEscrito el 09 Sep 2007 06:19 pm
Buenas tengo dos movieClip (tentacle y tentacle1)en mi biblioteca cada uno con su respectivo linkager como puedo hacer para llamar a los dos movieClip miren esta es una parte de mi codigo que hago las llamadas

Código :

Object.environment = this;
Math.prototype.degrees = function(r) {
   return (r*180/Math.PI);
};

maxtents = 3;
this.onEnterFrame = function() {
   if ((tents<maxtents)) { 
                var nombre1="tent1"+String(depth1++);
      var nombre="tent"+String(depth++);            
      var neo=this.attachMovie("tentacle",nombre,depth);
      var neo1=this.attachMovie("tentacle1",nombre1,depth1);
      neo._x=400;
      neo._y=100;
      neo1._x=400;
           neo1._y=156;
      neo.theta=390;
      neo1.theta1=170;
      tents++;
   }
}
stop();]


y cada movieClip tiene esto como codigo

Código :

/#initclip 
// constructor
function TentacleClass() {
   // total number of nodes
   this.numNodes = 27;
   // the general size and speed
   this.head = 1+random(2);//movimiento en forma de onda
   this.girth = 8+random(12);
   // locomotion efficiency (0 - 1)
   this.speedCoefficient=.09+random(10)/50;
   // the viscosity of the water (0 - 1)   
   this.friction=.90+random(10)/100;
   // muscular range
   this.muscleRange=200+random(50);
   // muscular frequency
   this.muscleFreq=.1+random(100)/15;
   // create point array to represent nodes
   this.generateNodes();

   // swim
   this.onEnterFrame = this.move;
}

// allow component to inherit MovieClip properties
TentacleClass.prototype = new MovieClip();
// instance methods

TentacleClass.prototype.generateNodes = function() {
   // create all body part nodes
   this.node = new Array();
   for (var n=0;n<this.numNodes;n++) {
      var point = {x:0,y:0};
      this.node.push(point);
   }
}
TentacleClass.prototype.move = function() {
   // mouse handle - uncomment to control tentacles with mouse
   this.node[0].x = this._xmouse;
    this.node[0].y = this._ymouse;
   
   // directional node with orbiting handle
   // arbitrary direction
   this.tv+=0.5*(Math.random()-Math.random());
   this.theta+=this.tv;
   this.tv*=this.friction;
   this.node[0].x = -1.5;
   this.node[0].y = -9.5;
   
   // muscular node
   this.count+=this.muscleFreq;
   this.thetaMuscle=this.muscleRange*Math.sin(this.count);
   this.node[1].x =-this.head*Math.cos(Math.PI / 180 * (this.theta+this.thetaMuscle));
   this.node[1].y = -this.head*Math.sin(Math.PI / 180 * (this.theta+this.thetaMuscle));

   // apply kinetic forces down through body nodes
   for (var i=2; i<this.numNodes; i++){
      var dx = this.node[i].x - this.node[i - 2].x;
      var dy = this.node[i].y - this.node[i - 2].y;
      
      var d = Math.sqrt (dx * dx + dy * dy);
      this.node[i].x = this.node[i - 1].x + (dx * this.girth) / d;
      //trace(this.node[i - 1].x + (dx * this.girth) / d)
      this.node[i].y = this.node[i - 1].y + (dy * this.girth) / d;
      if (i==2) {   
            this._x=1;
            this._y=1;
            if (((this._x+this._width)<0) || ((this._x-this._width)>300) || ((this._y+this._height)<0) || ((this._y-this._height)>200)) {
               // no longer visible, remove
               Object.environment.tents--;
               this.removeMovieClip();
            }
      }
   }
   
   // draw nodes using lines   
   this.clear();
   this.moveTo(this.node[2].x,this.node[2].y);
   for (var i=2; i<this.numNodes; i++){

      this.lineStyle(int(this.numNodes+i)*(this.numNodes-i)/10, 0xD2271D, 100);  // with no head
   this.lineTo(this.node[i].x,this.node[i].y);
   }
};
// Connect the class with the linkage ID for this movie clip
Object.registerClass("tentacle", TentacleClass);

#endinitclip

lo mismo tiene el otro movieClip pero en la ultima linea es
Object.registerClass("tentacle1", TentacleClass);[/quote]

Por juan_gv

108 de clabLevel



 

firefox
Citar            
MensajeEscrito el 13 Sep 2007 03:10 am
ayuda please :(

Por juan_gv

108 de clabLevel



 

firefox
Citar            
MensajeEscrito el 13 Sep 2007 03:27 pm
Los movieclips los debes atachar a otro movieclip instanciado.
Por ejemplo, puedes crear movieclips vacios, y despues atachar tus tentaculos a los movieclips vacios, porque lo que haces es atachar tus tentaculos a unas variables que nunca se muestran.

Código :

mc1 = create
var neo:MovieClip = this.createEmptyMovieClip("container", this.getNextHighestDepth());
var neo1:MovieClip = this.createEmptyMovieClip("container1", this.getNextHighestDepth());
neo.attachMovie("tentacle",nombre,depth);
neo1.attachMovie("tentacle1",nombre1,depth1);

Por gabynufe

Claber

446 de clabLevel



 

México, D.F.

msie7
Citar            
MensajeEscrito el 14 Sep 2007 03:47 am
mmm probe lo que me dijiste y no funka, mira en el codigo que te moestre si le quito un movieClip si funciona el codigo ese pero solo para uno, pero no se como llamar a dos

Por juan_gv

108 de clabLevel



 

firefox
Citar            
MensajeEscrito el 18 Sep 2007 09:11 pm
no me olviden:(

Por juan_gv

108 de clabLevel



 

firefox
Citar            
MensajeEscrito el 18 Sep 2007 09:26 pm

Código :

maxtents = 3;
this.onEnterFrame = function() {
   if ((tents<maxtents)) { 
      var nombre1="tent1"+String(depth1++);
      var nombre="tent"+String(depth++);            
      this.attachMovie("tentacle",nombre,depth, {_x:400, _y:100, theta:390});
      this.attachMovie("tentacle1",nombre1,depth1, {_x:400, _y:156, theta:170});
      tents++;
   }
}


Por cierto ¿Cómo cambias la profundidad? Revisa eso porque si no la cambias estás sobreescribendo un movieclip con el siguiente. Piensa en usar "getNextHighestDepth()".

Por The Fricky!

Presidente

6168 de clabLevel

3 tutoriales
8 articulos

Genero:Masculino   Bastard Operators From Hell Héroes

Piccola Venezia...

firefox
Citar            
MensajeEscrito el 19 Sep 2007 05:25 am
nada no me salen los dos que tentaculos que quiero :( me sale uno no mas el codigo lo cambie por el que me diste aqui y la parte de arriba que puse esta = son dos movie clips el codigo esta arriba, cada movie clip tiene un coidigo similar lo unico que cambia es Object.registerClass("tentacle1", TentacleClass);,

Por juan_gv

108 de clabLevel



 

firefox
Citar            
MensajeEscrito el 19 Sep 2007 12:53 pm
Una pregunta capciosa ¿Cuál de los dos es el que te sale, el primero o el segundo?

Por The Fricky!

Presidente

6168 de clabLevel

3 tutoriales
8 articulos

Genero:Masculino   Bastard Operators From Hell Héroes

Piccola Venezia...

firefox
Citar            
MensajeEscrito el 19 Sep 2007 10:58 pm
cuando comento
//this.attachMovie("tentacle",nombre,depth, {_x:400, _y:100, theta:390});
this.attachMovie("tentacle1",nombre1,depth1, {_x:40, _y:156, theta:170});
igual sale solo un tentaculo
cuando comento
this.attachMovie("tentacle",nombre,depth, {_x:400, _y:100, theta:390});
// this.attachMovie("tentacle1",nombre1,depth1, {_x:40, _y:156, theta:170});
igual sale solo un tentaculo

Por juan_gv

108 de clabLevel



 

firefox
Citar            
MensajeEscrito el 20 Sep 2007 01:44 am
Ok, no comentes ninguno.

Por The Fricky!

Presidente

6168 de clabLevel

3 tutoriales
8 articulos

Genero:Masculino   Bastard Operators From Hell Héroes

Piccola Venezia...

firefox
Citar            
MensajeEscrito el 20 Sep 2007 05:36 am
si no comento ninguno = solo me sale uno y no estan superpuestos tampoco pork que muevo el x e y de alguno de los dos y solo se ve uno

Por juan_gv

108 de clabLevel



 

firefox
Citar            
MensajeEscrito el 20 Sep 2007 03:06 pm
Ok ¿Cuál de los dos te sale cuando no comentas ninguno, el primero o el segundo? Si es el segundo, revisa los niveles de profundidad porque es muy probable estés cargando ambos en el mismo nivel.

Por The Fricky!

Presidente

6168 de clabLevel

3 tutoriales
8 articulos

Genero:Masculino   Bastard Operators From Hell Héroes

Piccola Venezia...

firefox
Citar            
MensajeEscrito el 20 Sep 2007 03:23 pm

Por gabynufe

Claber

446 de clabLevel



 

México, D.F.

msie7
Citar            
MensajeEscrito el 22 Sep 2007 07:44 pm
te mande el correo hace 4 dias , respondme please gaby

Por juan_gv

108 de clabLevel



 

firefox

 

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