Comunidad de diseño web y desarrollo en internet online

poder mover esto con el raton ¿como?

Citar            
MensajeEscrito el 14 Ago 2005 12:47 am
Hola, llevo toda la noche con este dichoso ejercicio, lo saque de un libro que me han dejado y me esta costando entenderlo cantidad, pero lo que me mata es que estoy intentando por variarlo un poco hacer con algun evento de raton que el raton sea el puntero del dibujillo en movimiento que aparece(quiezir poder mover el dibujo con el raton), pero no se como es he probado de todo y no se me ocurren ideas ya ¿alguien podria ayudarme?
Este es el codigo



Código :

function drawQuad(clip, color) {
   path = _root.page4[clip];
   path.clear();
   path.lineStyle(0, 0xFFFFFF, 30);
   path.beginFill(color, 30);
   path.moveTo(x[0], y[0]);
   path.lineTo(x[1], y[1]);
   path.lineTo(x[2], y[2]);
   path.lineTo(x[3], y[3]);
   path.endFill(x[0], y[0]);
}


// Define screen extents for later use...
Stage.scaleMode = "exactFit";
middleX = Stage.width/2;
middleY = Stage.height/2;
Stage.scaleMode = "noScale";
/*
create clip...
*/
_root.createEmptyMovieClip("page4", 100);
page4._x = middleX;
page4._y = middleY;
for (i=0; i<16; i++) {
   page4.createEmptyMovieClip("quad"+i, i);
   page4["quad"+i]._rotation = i*(360/16);
}
/*
Initialize points...
*/
width = 100;
height = 100;
x = new Array();
y = new Array();
sX = new Array();
sY = new Array();
x[0] = 0;
y[0] = 0;
x[1] = 0;
y[1] = -height;
x[2] = -width;
y[2] = -height;
x[3] = -width;
y[3] = 0;
for (i=1; i<4; i++) {
   sX[i] = Math.random()*2+2;
   sY[i] = Math.random()*2+2;
}

page4.onEnterFrame = function() {
   for (i=1; i<4; i++) {
      x[i] += sX[i];
      y[i] += sY[i];
      if (Math.abs(x[i])>width) {
         sX[i] = -sX[i];
      }
      if (Math.abs(y[i])>height) {
         sY[i] = -sY[i];
      }
   }
   for (i=0; i<16; i++) {
      drawQuad("quad"+i, 0x0);
   }
};

Por neoarcangel

39 de clabLevel



 

firefox
Citar            
MensajeEscrito el 14 Ago 2005 01:52 am
sencillo asi:

Código :

page4.onEnterFrame = function() {
   this._x= _xmouse; //<--nueva linea x del mouse en el escenario
   this._y= _ymouse;//<-- nueva linea y del mouse
   for (i=1; i<4; i++) {
      x[i] += sX[i];
      y[i] += sY[i];
      if (Math.abs(x[i])>width) {
         sX[i] = -sX[i];
      }
      if (Math.abs(y[i])>height) {
         sY[i] = -sY[i];
      }
   }
   for (i=0; i<16; i++) {
      drawQuad("quad"+i, 0x0);
   }
};

solo agregas esas lineas y listo

esta muy bueno e interesante el ejemplo :wink:
:D

Por Maikel

BOFH

5575 de clabLevel

22 tutoriales
5 articulos

Genero:Masculino   Team Cristalab

Claber de baja indefinida

firefox
Citar            
MensajeEscrito el 14 Ago 2005 02:12 am
:lol: :lol: :lol: :lol: Ya ..ta :lol: :lol: :lol: :lol:
funciono, dios con lo facil que era y lo que he visto ejemplos de ese tipo, sera que ya llevaba unas 5 horas con flash y ya no veia nada.
Muchas gracias Michael eres mi angel de la guarda
Saludos ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ :D :D :D :D :D :D :D :D :D :D

Por neoarcangel

39 de clabLevel



 

firefox
Citar            
MensajeEscrito el 14 Ago 2005 03:04 am
de nada, siempre a la orden :D

Maikel no Michael :roll:

saludos

Por Maikel

BOFH

5575 de clabLevel

22 tutoriales
5 articulos

Genero:Masculino   Team Cristalab

Claber de baja indefinida

firefox
Citar            
MensajeEscrito el 14 Ago 2005 03:11 am
lo siento, no me di cuenta

Por neoarcangel

39 de clabLevel



 

firefox

 

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