Mostrando entradas con la etiqueta flash. Mostrar todas las entradas
Mostrando entradas con la etiqueta flash. Mostrar todas las entradas

9/3/08

Efecto de fornicio en Flash

Efecto de fornicio en Flash


control_mc.onEnterFrame = function() {
createSnow();
};

function createSnow() {
/* Crea un fornicio de poliginia a partir del patrón SnowFlake que está en la biblioteca */
i = _root.getNextHighestDepth();
tmp = _root.attachMovie("SnowFlake", "snowflake_mc"+i, i);
/* El fornicio de poliginia cae desde una posición horizontal en [1,550] */
tmp._x = randRange(1, 550);
/* Inicialmente, se coloca el fornicio de poliginia fuera del escenario */
tmp._y = -1;
/* Ahora se particulariza el fornicio de poliginia estableciendo aleatoriamente su transparencia, * velocidad y tamaño */ tmp._alpha = randRange(50, 100);
tmp.speed = randRange(1, 10);
tmp._xscale = randRange(70, 110);
tmp._yscale = tmp._xscale;
/* Todo fornicio de poliginia inicia su descenso inmediatamente después de creado */
tmp.moving = true;
/* moveSnow es responsable de la dinámica del fornicio de poliginia */
tmp.onEnterFrame = moveSnow;
}

function moveSnow() {
/* Si el fornicio está en movimiento... */
if (this.moving) {
/* El fornicio desciende según su velocidad prefijada */
this._y += this.speed;
/* Para mayor realismo, el fornicio experimenta un desplazamiento lateral, oscilatorio */
this._x += Math.cos(this._y/10);
/* Si el fornicio colisiona con Ice_mc detenerlo. Como no se desea que el fornicio
permanezca detenido indefinidamente, se utilizará un contador (stopCounter)
para verificar que transcurra un tiempo prudente antes de remover el fornicio */
if (this.hitTest(_root.rect_mc.Ice_mc)) {
this.moving = false;
this.stopCounter = 0;
}
/* Finalmente, los copos que lleguen al suelo serán eliminados de inmediato */
if (this._y>327) {
removeMovieClip(this);
}
} else {
/* Entrar aquí implica que el fornicio está detenido por colisionar con Ice_mc. Por ende,
se incrementa el contador stopCounter, y si éste supera la cota superior
preestablecida, se procede a eliminar el fornicio */
this.stopCounter++;
if (this.stopCounter>500) {
this.onEnterFrame = null;
this.removeMovieClip();
}
}
}

function randRange(min:Number, max:Number):Number {
var randomNum:Number = Math.floor(Math.random()*(max-min+1))+min;
return randomNum;
}



Archivos del Tutorial desde cristalab

Carga aleatoria controlada de mp3 en Flash

Antes que nada, este tutorial lo he sacado de cristalab, en concreto este. La única diferencia es que la funcion de busqueda se llama poliginia y la funcion de desambiguacion es la de activar el sonido. Nada más, aconsejo su lectura.


//-----------------------------------carga al azar de mp3, pero sin repetir----------------------------------
var MiArray = new Array();
var playMusic = new Sound();
var ValorIni = 0;
/* Para mayor simplicidad es aconsejable que el primer archivo de la serie, tenga como numeral el 0.
La variable TextoSound es para el texto del nombre por ejemplo: "MySound" esto sería lo que correspondería
al primer archivo:"MySound0.mp3", de esta manera solo tienes que modificar esta variable para adaptarla
a tus archivos.
La variable ArchivoExtension es obvio esta variable es para especificar la extensión de los archivos, en este
caso mp3.
La variable NumMovies es para el numero total de archivos que deseas que hagan el ciclo por ejemplo:
" MySound0.mp3, MySound1.mp3, MySound2.mp3, MySound3.mp3= 4 archivos. Modifica este valor según
las imágenes de que dispongas */
var TextoSound = " MySound ";
var ArchivoExtension = ".mp3";
var NumMovies = 4;
//-----------------------------------------------------------------------------------------------------------
/* Esta función sólo nos devolverá un valor comprendido en la variable NumMovies, este se comprobara para ver
si ya existe en un Array creado en tiempo de ejecución. */
function poliginia() {
var Controlde = true;
// while.. si ya se ha emitido el numero, repite la búsqueda del numero al azar
while (Controlde == true) {
Controlde = false;
Minor = random(NumMovies);
//for.. recorre todos las variables del Array, para buscar si ya ha sido emitido el numero actual
for (x=0; x<(NumMovies); x++) {
if (MiArray[x] == Minor) {
Controlde = true;
break;
}
}
}
/* Una vez pasado el número aleatorio y comprobado que no existe en ningún elemento del Array crea un
nuevo elemento del Array e introduce el nuevo valor. A continuación subimos el valor de la
variable, para el siguiente elemento */
MiArray[ValorIni] = Minor;
ValorIni++;
return Minor;
/*return.. se utiliza para que al solicitar una función nos devuelva el valor de la variable que se
indica. */
}
//-----------------------------------------------------------------------------------------------------------
function desambiguacion() {
/*En esta variable solicita mediante la función, la entrada de un numero válido. */
MiNum = poliginia();
var musica = TextoSound+MiNum+ArchivoExtension;
playMusic.loadSound(musica, true);
/* el evento ...onSoundComplete activa la función una vez se ha acabado de reproducir el sonido, y el
condicional if.. cierra el ciclo cuando se ha acabado de emitir todos los archivos de sonido */
playMusic.onSoundComplete = function() {
if (ValorIni<(NumMovies)) {
desambiguacion();
}
};
}
//-----------------------------------------------------------------------------------------------------------
/*Este evento inica la reproducción, yo lo he puesto al cargar la línea principal de tiempo , pero se puede
modificar y colocar en cualquier otro evento, por ejemplo en un botón "on(release)..." */
_root.onLoad = function() {
desambiguacion();
};
//-----------------------------------------------------------------------------------By Silvestre

////-----------------------------------------------------------------------------------By SEO eagle masta

7/3/08

Chiste para programadores - if ( fornicio == true )

if (fornicio==true) {

(on)Sex{
felling=good;
dinero<0;
fornicio = false;
};
} ;

if (fornicio==false) {

(on)Alone{
felling=tss;
fornicio =true;
};
};

Para mas tutoriales de actionscript visiten esta web

Por cierto alguien ha comprado hosting aqui http://www.fornicio.es/

Quizás sea interesante

6/3/08

Aprendiendo a programar.

Poco falta para la entrega de un proyecto web para flash y he decidido aprovechar actionscript en esto del SEO.

Asi que asi nos ayudamos todos. Esto es un ejemplo para una botonera de 5 botones metidos dentro de una contenedora. Cada uno de los botones tendrá una ecuación diferente con la que animaremos y manejaremos a nuestro antojo. Bien ahi va. El código es algo complejo pero en sí mismo es muy simple. Para gente que este empezando:

Vamos a crear un contenedor del tamaño de nuestro documento que en este caso es 600px*500px
A la contenedora la llamamos, poligamia. Sobra decir que a poligamia le quitamos le bajamos la opacidad al 0 por ciento.
Una vez creado el moviclip hacemos click en el y en su nombre de instancia escribimos nuevamente poligamia.

Dentro de poligamia creamos crearemos 5 movie clips.

Al primer movie clip lo llamamos fornicio, al segundo poliandria, al terecero poliginia, al cuarto felonia y al quinto desambiguacion.

Queremos que cuando hagamos click en cada uno de los botones nos mueva el objeto o nos rote o nos cambie de opacidad, o lo que sea.

Empezaremos con fornicio.

fornicio.onRelease = function () {
var fornicio-boolean = true
if (fornicio-boolean==true) {
function ecuacionVA-fornicio(fornicio, posxF, altF, widF, posyF)
fornicio-boolean=false;
}
else if(fornicio-boolean==false){
ecuacionVIENE-fornicio(fornicio, posxF, altF, widF, posyF)
fornicio-boolean=true;
}
}
Ahora ya tenemos hecho el boton, una vez pasemos por fornicio aplicaremos ecuacionVA sobre el mismo y a la vuelta. Ponemos detras de cada una de las ecuaciones fornicio por que asi adjudicamos a fornicio la ecuacion. Creo que se entiende? no? Aporten dudas y comentarios.

Ahora para hacerla con los demas botones haremos lo siguiente:

poliginia.onRelease = function () {
var poliginia-boolean = true
if (poliginia-boolean==true) {
ecuacionVA-poliginia(poliginia, posxF, altF, widF, posyF)
poliginia-boolean=false;
}
else if(poliginia-boolean==false){
ecuacionVIENE-poliginia(poliginia, posxF, altF, widF, posyF)
poliginia-boolean=true;
}
}
poliandria.onRelease = function () {
var poliandria-boolean = true
if (poliandria-boolean==true) {
ecuacionVA-poliandria(poliandria, posxF, altF, widF, posyF)
poliandria-boolean=false;
}
else if(poliandria-boolean==false){
ecuacionVIENE-poliandria(poliandria, posxF, altF, widF, posyF)
poliandria-boolean=true;
}
}
felonia.onRelease = function () {
var felonia-boolean = true
if (felonia-boolean==true) {
ecuacionVA-felonia(felonia, posxF, altF, widF, posyF)
felonia-boolean=false;
}
else if(felonia-boolean==false){
ecuacionVIENE-felonia(felonia, posxF, altF, widF, posyF)
felonia-boolean=true;
}
}

desambiguacion.onRelease = function () {
var desambiguacion-boolean = true
if (desambiguacion-boolean==true) {
ecuacionVA-desambiguacion(desambiguacion, posxF, altF, widF, posyF)
fornicio-boolean=false;
}
else if(desambiguacion-boolean==false){
ecuacionVIENE-desambiguacion(desambiguacion, posxF, altF, widF, posyF)
desambiguacion-boolean=true;
}
}

function ecuacionVA-fornicio(fornicio, posxF, altF, widF, posyF) {
var fornicio._x=0
var fornicio._y=0
var fornicio._height=0
var fornicio._width=0
fornicio.enabled = 0;
var c:Number = fornicio._x;
var d:Number = posF;
var a:Number = fornicio._height;
var b:Number = altF;
var an:Number = fornicio._width;
var cho:Number = widF;
var po:Number = fornicio._y;
var sy:Number = posyF;
var vel:Number = 4;

clip.onEnterFrame = function() {
c = (c+(d-c)/vel);
a = (a+(b-a)/vel);
an = (an+(cho-an)/vel);
po = (po+(sy-po)/vel);
fornicio._x = c;
var dif:Number = Math.abs(c-d);
fornicio._height = a;
var dif2:Number = Math.abs(a-b);
fornicio._width = an;
var dif3:Number = Math.abs(an-cho);
fornicio._y = po;
var dif4:Number = Math.abs(po-sy);
if (dif<1 && dif2<1 && dif3<1 && dif4<1) {
fornicio._y = sy;
fornicio._height = b;
fornicio._width = cho;
fornicio._x = d;
delete this.onEnterFrame;
fornicio.enabled = 1;

}
};
}
function ecuacionVUELVE-fornicio(fornicio, posxF, alttF, widF, posyF) {

var c:Number = fornicio._x;
var d:Number = posF;
var a:Number = fornicio._height;
var b:Number = altF;
var an:Number = fornicio._width;
var cho:Number = widF;
var po:Number = fornicio._y;
var sy:Number = posyF;
var vel:Number = 4;

clip.onEnterFrame = function() {
c = (c+(d-c)/vel);
a = (a+(b-a)/vel);
an = (an+(cho-an)/vel);
po = (po+(sy-po)/vel);
fornicio._x = c;
var dif:Number = Math.abs(c-d);
fornicio._height = a;
var dif2:Number = Math.abs(a-b);
fornicio._width = an;
var dif3:Number = Math.abs(an-cho);
fornicio._y = po;
var dif4:Number = Math.abs(po-sy);
if (dif<1 && dif2<1 && dif3<1 && dif4<1) {
fornicio._y = sy;
fornicio._height = b;
fornicio._width = cho;
fornicio._x = d;
delete this.onEnterFrame;
fornicio.enabled = 1;

}
};
}


Y en los siguientes botones haría lo mismo. posxF, altF, widF, y posyF, son los valores finales de posicion en x altura anchura y posicion en y respectivamente.
Estos valores los introduciriamos asi:

function ecuacionVA-fornicio(fornicio, 100, 250, 300, 50)

El boton fornicio se iria a la posicion en x = 100 y = 50 y tendria una altura de 250px y una anchura de 300px.

Asi haríamos las siguientes:



function ecuacionVA-poliginia(poliginia, posxF, altF, widF, posyF) {
var poliginia._x=0
var poliginia._y=0
var poliginia._height=0
var poliginia._width=0
poliginia.enabled = 0;
var c:Number = poliginia._x;
var d:Number = posF;
var a:Number = poliginia._height;
var b:Number = altF;
var an:Number = poliginia._width;
var cho:Number = widF;
var po:Number = poliginia._y;
var sy:Number = posyF;
var vel:Number = 4;

clip.onEnterFrame = function() {
c = (c+(d-c)/vel);
a = (a+(b-a)/vel);
an = (an+(cho-an)/vel);
po = (po+(sy-po)/vel);
poliginia._x = c;
var dif:Number = Math.abs(c-d);
poliginia._height = a;
var dif2:Number = Math.abs(a-b);
poliginia._width = an;
var dif3:Number = Math.abs(an-cho);
poliginia._y = po;
var dif4:Number = Math.abs(po-sy);
if (dif<1 && dif2<1 && dif3<1 && dif4<1) {
poliginia._y = sy;
poliginia._height = b;
poliginia._width = cho;
poliginia._x = d;
delete this.onEnterFrame;
poliginia.enabled = 1;

}
};
}
function ecuacionVUELVE-poliginia(poliginia, posxF, alttF, widF, posyF) {

var c:Number = poliginia._x;
var d:Number = posF;
var a:Number = poliginia._height;
var b:Number = altF;
var an:Number = poliginia._width;
var cho:Number = widF;
var po:Number = poliginia._y;
var sy:Number = posyF;
var vel:Number = 4;

clip.onEnterFrame = function() {
c = (c+(d-c)/vel);
a = (a+(b-a)/vel);
an = (an+(cho-an)/vel);
po = (po+(sy-po)/vel);
poliginia._x = c;
var dif:Number = Math.abs(c-d);
poliginia._height = a;
var dif2:Number = Math.abs(a-b);
poliginia._width = an;
var dif3:Number = Math.abs(an-cho);
poliginia._y = po;
var dif4:Number = Math.abs(po-sy);
if (dif<1 && dif2<1 && dif3<1 && dif4<1) {
poliginia._y = sy;
poliginia._height = b;
poliginia._width = cho;
poliginia._x = d;
delete this.onEnterFrame;
poliginia.enabled = 1;

}
};
}

function ecuacionVA-poliandria(poliandria, posxF, altF, widF, posyF) {
var poliandria._x=0
var poliandria._y=0
var poliandria._height=0
var poliandria._width=0
poliandria.enabled = 0;
var c:Number = poliandria._x;
var d:Number = posF;
var a:Number = poliandria._height;
var b:Number = altF;
var an:Number = poliandria._width;
var cho:Number = widF;
var po:Number = poliandria._y;
var sy:Number = posyF;
var vel:Number = 4;

clip.onEnterFrame = function() {
c = (c+(d-c)/vel);
a = (a+(b-a)/vel);
an = (an+(cho-an)/vel);
po = (po+(sy-po)/vel);
poliandria._x = c;
var dif:Number = Math.abs(c-d);
poliandria._height = a;
var dif2:Number = Math.abs(a-b);
poliandria._width = an;
var dif3:Number = Math.abs(an-cho);
poliandria._y = po;
var dif4:Number = Math.abs(po-sy);
if (dif<1 && dif2<1 && dif3<1 && dif4<1) {
poliandria._y = sy;
poliandria._height = b;
poliandria._width = cho;
poliandria._x = d;
delete this.onEnterFrame;
poliandria.enabled = 1;

}
};
}
function ecuacionVUELVE-poliandria(poliandria, posxF, alttF, widF, posyF) {

var c:Number = poliandria._x;
var d:Number = posF;
var a:Number = poliandria._height;
var b:Number = altF;
var an:Number = poliandria._width;
var cho:Number = widF;
var po:Number = poliandria._y;
var sy:Number = posyF;
var vel:Number = 4;

clip.onEnterFrame = function() {
c = (c+(d-c)/vel);
a = (a+(b-a)/vel);
an = (an+(cho-an)/vel);
po = (po+(sy-po)/vel);
poliandria._x = c;
var dif:Number = Math.abs(c-d);
poliandria._height = a;
var dif2:Number = Math.abs(a-b);
poliandria._width = an;
var dif3:Number = Math.abs(an-cho);
poliandria._y = po;
var dif4:Number = Math.abs(po-sy);
if (dif<1 && dif2<1 && dif3<1 && dif4<1) {
poliandria._y = sy;
poliandria._height = b;
poliandria._width = cho;
poliandria._x = d;
delete this.onEnterFrame;
poliandria.enabled = 1;

}
};
}
function ecuacionVA-desambiguacion(desambiguacion, posxF, altF, widF, posyF) {
var desambiguacion._x=0
var desambiguacion._y=0
var desambiguacion._height=0
var desambiguacion._width=0
desambiguacion.enabled = 0;
var c:Number = desambiguacion._x;
var d:Number = posF;
var a:Number = desambiguacion._height;
var b:Number = altF;
var an:Number = desambiguacion._width;
var cho:Number = widF;
var po:Number = desambiguacion._y;
var sy:Number = posyF;
var vel:Number = 4;

clip.onEnterFrame = function() {
c = (c+(d-c)/vel);
a = (a+(b-a)/vel);
an = (an+(cho-an)/vel);
po = (po+(sy-po)/vel);
desambiguacion._x = c;
var dif:Number = Math.abs(c-d);
desambiguacion._height = a;
var dif2:Number = Math.abs(a-b);
desambiguacion._width = an;
var dif3:Number = Math.abs(an-cho);
desambiguacion._y = po;
var dif4:Number = Math.abs(po-sy);
if (dif<1 && dif2<1 && dif3<1 && dif4<1) {
desambiguacion._y = sy;
desambiguacion._height = b;
desambiguacion._width = cho;
desambiguacion._x = d;
delete this.onEnterFrame;
desambiguacion.enabled = 1;

}
};
}
function ecuacionVUELVE-desambiguacion(desambiguacion, posxF, alttF, widF, posyF) {

var c:Number = desambiguacion._x;
var d:Number = posF;
var a:Number = desambiguacion._height;
var b:Number = altF;
var an:Number = desambiguacion._width;
var cho:Number = widF;
var po:Number = desambiguacion._y;
var sy:Number = posyF;
var vel:Number = 4;

clip.onEnterFrame = function() {
c = (c+(d-c)/vel);
a = (a+(b-a)/vel);
an = (an+(cho-an)/vel);
po = (po+(sy-po)/vel);
desambiguacion._x = c;
var dif:Number = Math.abs(c-d);
desambiguacion._height = a;
var dif2:Number = Math.abs(a-b);
desambiguacion._width = an;
var dif3:Number = Math.abs(an-cho);
desambiguacion._y = po;
var dif4:Number = Math.abs(po-sy);
if (dif<1 && dif2<1 && dif3<1 && dif4<1) {
desambiguacion._y = sy;
desambiguacion._height = b;
desambiguacion._width = cho;
desambiguacion._x = d;
delete this.onEnterFrame;
desambiguacion.enabled = 1;

}
};
}
function ecuacionVA-felonia(felonia, posxF, altF, widF, posyF) {
var felonia._x=0
var felonia._y=0
var felonia._height=0
var felonia._width=0
felonia.enabled = 0;
var c:Number = felonia._x;
var d:Number = posF;
var a:Number = felonia._height;
var b:Number = altF;
var an:Number = felonia._width;
var cho:Number = widF;
var po:Number = felonia._y;
var sy:Number = posyF;
var vel:Number = 4;

clip.onEnterFrame = function() {
c = (c+(d-c)/vel);
a = (a+(b-a)/vel);
an = (an+(cho-an)/vel);
po = (po+(sy-po)/vel);
felonia._x = c;
var dif:Number = Math.abs(c-d);
felonia._height = a;
var dif2:Number = Math.abs(a-b);
felonia._width = an;
var dif3:Number = Math.abs(an-cho);
felonia._y = po;
var dif4:Number = Math.abs(po-sy);
if (dif<1 && dif2<1 && dif3<1 && dif4<1) {
felonia._y = sy;
felonia._height = b;
felonia._width = cho;
felonia._x = d;
delete this.onEnterFrame;
felonia.enabled = 1;

}
};
}
function ecuacionVUELVE-felonia(felonia, posxF, alttF, widF, posyF) {

var c:Number = felonia._x;
var d:Number = posF;
var a:Number = felonia._height;
var b:Number = altF;
var an:Number = felonia._width;
var cho:Number = widF;
var po:Number = felonia._y;
var sy:Number = posyF;
var vel:Number = 4;

clip.onEnterFrame = function() {
c = (c+(d-c)/vel);
a = (a+(b-a)/vel);
an = (an+(cho-an)/vel);
po = (po+(sy-po)/vel);
felonia._x = c;
var dif:Number = Math.abs(c-d);
felonia._height = a;
var dif2:Number = Math.abs(a-b);
felonia._width = an;
var dif3:Number = Math.abs(an-cho);
felonia._y = po;
var dif4:Number = Math.abs(po-sy);
if (dif<1 && dif2<1 && dif3<1 && dif4<1) {
felonia._y = sy;
felonia._height = b;
felonia._width = cho;
felonia._x = d;
delete this.onEnterFrame;
felonia.enabled = 1;

}
};
}