Foros del Web » Creando para Internet » Flash y Actionscript »

Un Flash Entrete

Estas en el tema de Un Flash Entrete en el foro de Flash y Actionscript en Foros del Web. //******************************* System.setCodePage = true; formato = new TextFormat(); formato.font = "standard 07_53"; formato.color = 0xFFFF00; formato.size = 12; this.createTextField("miTexto_txt", 8, 50, 230, 350, 100); miTexto_txt.embedFonts ...
  #1 (permalink)  
Antiguo 23/07/2003, 07:04
Avatar de maralbust@netsc  
Fecha de Ingreso: julio-2003
Ubicación: Santiago
Mensajes: 242
Antigüedad: 20 años, 8 meses
Puntos: 0
De acuerdo Un Flash Entrete

//*******************************
System.setCodePage = true;
formato = new TextFormat();
formato.font = "standard 07_53";
formato.color = 0xFFFF00;
formato.size = 12;
this.createTextField("miTexto_txt", 8, 50, 230, 350, 100);
miTexto_txt.embedFonts = true;
miTexto.autoSize = true;
this.createTextField("titulo_txt", 9, 80, 20, 350, 100);
titulo_txt.embedFonts = true;
titulo_txt.html = true;
titulo_txt.autoSize = true;
formato2 = new TextFormat();
formato2.font = "standard 07_53";
formato2.color = 0xFFFF00;
formato2.size = 20;
titulo_txt.setTextFormat(formato2);
titulo_txt.textSize = 10;
//*******************************
//arreglos para nombrar los dias y meses al recibir el valor de estos en numero
_global.dia = ["Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sábado"];
_global.mes = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"];
//declaramos cual sera el punto de origen para las manecillas
_global.xCentro = 750;
_global.yCentro = 50;
_global.xInicio = 0;
_global.yInicio = 0;
_global.alfa = 100;
_global.ancho = 2;
_global.radio = 30;
//*************************************
MovieClip.prototype.putDepth = function() {
return ++this.depth;
};
//*************************************
MovieClip.prototype.dibujaCirculo = function(x, y, radio, anguloInicial, anguloFinal, segmentos) {
Math.rad = Math.PI/180;
lineStyle(ancho, 0xcccccc, alfa);
var segm = (anguloFinal-anguloInicial)/segmentos;
this.moveTo(x+radio*Math.cos(anguloInicial*Math.ra d), y+radio*Math.sin(anguloInicial*Math.rad));
for (var s = anguloInicial+segm; s<=anguloFinal+1; s += segm) {
var c_x = radio*Math.cos(s*Math.rad);
var c_y = radio*Math.sin(s*Math.rad);
var a_x = c_x+radio*Math.tan(segm/2*Math.rad)*Math.cos((s-90)*Math.rad);
var a_y = c_y+radio*Math.tan(segm/2*Math.rad)*Math.sin((s-90)*Math.rad);
this.curveTo(a_x+x, a_y+y, c_x+x, c_y+y);
}
};
//*************************************
lineStyle(ancho, 0x000000, alfa);
this.createEmptyMovieClip("reloj_mc", 0);
_root.reloj_mc._x += 200;
_root.reloj_mc._y += 200;
with ("reloj_mc") {
this.createEmptyMovieClip("circulo_mc", 4);
with (circulo_mc) {
this.dibujaCirculo(xCentro, yCentro, radio, 0, 360, 8);
}
//creamos clip para manecilla hora
this.createEmptyMovieClip("hora_mc", 2);
with (this.hora_mc) {
lineStyle(ancho, 0xcccccc, alfa);
moveTo(xInicio, yInicio);
lineTo(xInicio, yInicio-radio+12);
_x = xCentro;
_y = yCentro;
}
//creamos clip para manecilla minutos
this.createEmptyMovieClip("minutos_mc", 1);
with (this.minutos_mc) {
lineStyle(ancho, 0xcccccc, alfa);
moveTo(xInicio, yInicio);
lineTo(xInicio, yInicio-radio);
_x = xCentro;
_y = yCentro;
}
//funcion para crear manecillas
/* crearManecilla = function (nombreClip, prof, tono, punta) {
this.createEmptyMovieClip(nombreClip,3);
with (this.eval(nombreClip)) {
lineStyle(ancho, eval(tono), alfa);
moveTo(xInicio, yInicio);
lineTo(xInicio, yInicio-radio);
_x = xCentro;
_y = yCentro;
}
};
crearManecilla("segundos_mc",3,"0x33CCFF",yInicio-radio);
*/
//creamos clip para manecilla minutos
this.createEmptyMovieClip("segundos_mc", 3);
with (this.segundos_mc) {
lineStyle(ancho, 0xcccccc, alfa);
moveTo(xInicio, yInicio);
lineTo(xInicio, yInicio-radio);
_x = xCentro;
_y = yCentro;
}
cambiaHora = function () {
// creamos nuevo objeto Date
miFecha = new Date();
// estas lineas son solo para desplegar aqui en la ventana de salida los valores
trace(miFecha.getFullYear());
trace(mes[miFecha.getMonth()]);
trace(miFecha.getDate());
trace(dia[miFecha.getDay()]);
trace(miFecha.getHours());
trace(miFecha.getMinutes());
trace(miFecha.getSeconds());
// *******************************
// funcion con la que agregamos el CERO
function agregaCero(valor) {
// si el valor del numero es menor que 10...
if (valor<10) {
// concatenamos un 0 antes del valor original
valor = "0"+valor;
}
// regresamos valor
return valor;
}

// giramos cada una de las manecillas :D
// ***************************
// hora (las horas giran mas lento que los mins y segs. :P )
hora_mc._rotation = miFecha.getHours()*30;
// minutos
minutos_mc._rotation = miFecha.getMinutes()*6;
// segundos
segundos_mc._rotation = miFecha.getSeconds()*6;
};
cambiaHora();
setInterval(cambiaHora, 1000);
}
  #2 (permalink)  
Antiguo 23/07/2003, 07:36
Avatar de ea00d009  
Fecha de Ingreso: junio-2003
Ubicación: bariloche
Mensajes: 853
Antigüedad: 20 años, 9 meses
Puntos: 9
que es este script? un reloj en flash?
__________________
You were everything, everything that I wanted We were meant to be, supposed to be, but we lost it.
  #3 (permalink)  
Antiguo 29/07/2003, 12:51
Avatar de maralbust@netsc  
Fecha de Ingreso: julio-2003
Ubicación: Santiago
Mensajes: 242
Antigüedad: 20 años, 8 meses
Puntos: 0
si señor es un reloj analogo en falsh
  #4 (permalink)  
Antiguo 29/07/2003, 23:28
 
Fecha de Ingreso: abril-2003
Ubicación: México
Mensajes: 116
Antigüedad: 20 años, 11 meses
Puntos: 0
O_O 134 lineas para un reloj no mams ... ahora que estoy aprendiendo AS y para hacer un circulo me cuesta un pedin (14 lienas) ahora que veo esto O_O digo quien lo hiso?? a mi se me hace que esto lo hiso un programador. verda?
  #5 (permalink)  
Antiguo 30/07/2003, 09:00
Avatar de maralbust@netsc  
Fecha de Ingreso: julio-2003
Ubicación: Santiago
Mensajes: 242
Antigüedad: 20 años, 8 meses
Puntos: 0
eso lo hice yo me manejo mas en flash que en otros lenguajes.

asi es la vida
__________________
"La imaginacion es el limite"
bee-freaks
  #6 (permalink)  
Antiguo 30/07/2003, 12:52
Avatar de roc2107
ɹopɐɹǝpoɯ
 
Fecha de Ingreso: febrero-2003
Ubicación: León Guanajuato
Mensajes: 4.834
Antigüedad: 21 años, 1 mes
Puntos: 109
Muy bueno, para saber hacer esto realmente me falta mucho pero admiro a los que si saben. Saludos.

__________________
Blog de Diseño Gráfico roc21.com ||

El secreto de la creatividad es saber esconder tus fuentes.
  #7 (permalink)  
Antiguo 30/07/2003, 12:56
Avatar de maralbust@netsc  
Fecha de Ingreso: julio-2003
Ubicación: Santiago
Mensajes: 242
Antigüedad: 20 años, 8 meses
Puntos: 0
cuando se puede ayudar a alguien se debe hacer, si no jamas seremos los mejores.
__________________
"La imaginacion es el limite"
bee-freaks
  #8 (permalink)  
Antiguo 30/07/2003, 17:38
cmc
 
Fecha de Ingreso: febrero-2003
Ubicación: Capital
Mensajes: 1.317
Antigüedad: 21 años, 1 mes
Puntos: 1
Simplemente:

EXCELENTE!!!!!!!!!!!

  #9 (permalink)  
Antiguo 30/07/2003, 17:56
Avatar de TMeister
Crazy Coder
 
Fecha de Ingreso: enero-2002
Ubicación: En la Oficina
Mensajes: 2.880
Antigüedad: 22 años, 2 meses
Puntos: 193
A ver por ahi Fernado de OneLX hizo uno que me dejo asi

Ahi esta

/* Hecho para flash MX por: Fernando Flórez
* basado en el mismo experimento pero hecho en dhtml
* preguntas, sugerencias, etc -> [email protected]
*/
clockHeight = 50;
clockWidth = 50;
clockFromMouseY=0;
clockFromMouseX=100;

d = ["domingo", "lunes", "martes", "miercoles", "jueves", "viernes"];
m = ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio",
"agosto", "setiembre", "octubre", "noviembre", "diciembre"];
dia = new Date().getDate();
anio = new Date().getFullYear();
fechaHoy = " "+d[new Date().getDay()]+" "+dia+" "+m[new Date().getMonth()]+" "+anio;
d2 = fechaHoy.split("");
H = "...".split("");
M = "....".split("");
S = ".....".split("");
vel = 0.6;
tam = "1 2 3 4 5 6 7 8 9 10 11 12".split(" ");
split = 360/tam.length;
dsplit = 360/d2.length;
handHeight = clockHeight/4.5;
handWidth = clockWidth/4.5;
handY = -7;
handX = -2.5;
step = 0.06;
curStep = 0;
y = [];
x = [];
y2 = [];
x2 = [];
dy = [];
dx = [];
dy2 = [];
dx2 = [];
for(var i=0;i<tam.length;i++){
y.push(0);
x.push(0);
y2.push(0);
x2.push(0);
dy.push(0);
dx.push(0);
dy2.push(0);
dx2.push(0);
}
for(var i=0;i<d2.length;i++){
var tmp = createEmptyMovieClip("nsDate"+i, i);
with(tmp){
_x = _y = 0;
createTextField("texto", 0, 0, 0, null, null);
texto.autoSize = true;
texto.selectable = false;
texto.text = _parent.d2[i].toUpperCase();
}
}
for(var i=0;i<tam.length;i++){
var tmp = createEmptyMovieClip("nsFace"+i, (i+24));
with(tmp){
_x = _y = 0;
createTextField("texto", 0, 0, 0, null, null);
texto.autoSize = true;
texto.selectable = false;
texto.text = _parent.tam[i];
}
}
for(var i=0;i<S.length;i++){
var tmp = createEmptyMovieClip("nsSeconds"+i, (i+36));
with(tmp){
_x = _y = 0;
createTextField("texto", 0, 0, 0, null, null);
texto.autoSize = true;
texto.selectable = false;
texto.text = _parent.S[i];
}
}
for(var i=0;i<M.length;i++){
var tmp = createEmptyMovieClip("nsMinutes"+i, (i+41));
with(tmp){
_x = _y = 0;
createTextField("texto", 0, 0, 0, null, null);
texto.autoSize = true;
texto.selectable = false;
texto.text = _parent.M[i];
}
}
for(var i=0;i<H.length;i++){
var tmp = createEmptyMovieClip("nsHours"+i, (i+45));
with(tmp){
_x = _y = 0;
createTextField("texto", 0, 0, 0, null, null);
texto.autoSize = true;
texto.selectable = false;
texto.text = _parent.H[i];
}
}
function clockAndAssign(){
sec = -1.57 + Math.PI * new Date().getSeconds()/30;
min = -1.57 + Math.PI * new Date().getMinutes()/30;
hrs = -1.575 + Math.PI * new Date().getHours()/6+Math.PI*parseInt(new Date().getMinutes())/360;
for(var i=0;i<tam.length;i++){
this["nsFace"+i]._y = y[i] + clockHeight*Math.sin(-1.0471 + i*split*Math.PI/180);
this["nsFace"+i]._x = x[i] + clockWidth*Math.cos(-1.0471 + i*split*Math.PI/180);
}
for(var i=0;i<H.length;i++){
this["nsHours"+i]._y = y[i]+handY+(i*handHeight)*Math.sin(hrs);
this["nsHours"+i]._x = x[i]+handX+(i*handWidth)*Math.cos(hrs);
}
for(var i=0;i<M.length;i++){
this["nsMinutes"+i]._y = y[i]+handY+(i*handHeight)*Math.sin(min);
this["nsMinutes"+i]._x = x[i]+handX+(i*handWidth)*Math.cos(min);
}
for(var i=0;i<S.length;i++){
this["nsSeconds"+i]._y = y[i]+handY+(i*handHeight)*Math.sin(sec);
this["nsSeconds"+i]._x = x[i]+handX+(i*handWidth)*Math.cos(sec);
}
for(var i=0;i<d2.length;i++){
this["nsDate"+i]._y = dy[i] + clockHeight*1.5*Math.sin(curStep+i*dsplit*Math.PI/180);
this["nsDate"+i]._x = dx[i] + clockWidth*1.5*Math.cos(curStep+i*dsplit*Math.PI/180);
}
curStep -= step;
}
function delay(){
dy[0]= Math.round(dy2[0]+=((_ymouse+clockFromMouseY)-dy2[0])*vel);
dx[0]= Math.round(dx2[0]+=((_xmouse+clockFromMouseX)-dx2[0])*vel);
for (var i=1; i < d2.length; i++){
dy[i]= Math.round(dy2[i]+=(dy[i-1]-dy[i])*vel);
dx[i]= Math.round(dx2[i]+=(dx[i-1]-dx[i])*vel);
}
y[0]= Math.round(y2[0]+=((_ymouse+clockFromMouseY)-y2[0])*vel);
x[0]= Math.round(x2[0]+=((_xmouse+clockFromMouseX)-x2[0])*vel);
for (i=1; i < tam.length; i++){
y[i]= Math.round(y2[i]+=(y[i-1]-y2[i])*vel);
x[i]= Math.round(x2[i]+=(x[i-1]-x2[i])*vel);
}
clockAndAssign();
}
clockAndAssign();
delay();
setInterval(delay, 20);


Saludos!!
  #10 (permalink)  
Antiguo 30/07/2003, 21:28
Avatar de juwe  
Fecha de Ingreso: abril-2001
Ubicación: Guadalupe Inn
Mensajes: 622
Antigüedad: 22 años, 11 meses
Puntos: 0
__________________
blog.juwestudio
  #11 (permalink)  
Antiguo 30/07/2003, 22:24
 
Fecha de Ingreso: abril-2003
Ubicación: México
Mensajes: 116
Antigüedad: 20 años, 11 meses
Puntos: 0
ese script del reloj lo habia visto en JavaScript , pero el de el reloj digital si me dejo O_O a ver cuando me pasas unos tips maralbus o recomendaciones :) suerte man
  #12 (permalink)  
Antiguo 01/08/2003, 11:46
 
Fecha de Ingreso: julio-2003
Mensajes: 80
Antigüedad: 20 años, 7 meses
Puntos: 0
Como hago para verlo funcionando?
  #13 (permalink)  
Antiguo 01/08/2003, 11:48
 
Fecha de Ingreso: julio-2003
Mensajes: 80
Antigüedad: 20 años, 7 meses
Puntos: 0
ya lo hice

pense que la programacion se la ponia en un objeto, pero lo coloque en el primer frame y funciona. Esta una nota!!! Exelente!!!
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:23.