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

Fuente Global para todos los textBoxs

Estas en el tema de Fuente Global para todos los textBoxs en el foro de Flash y Actionscript en Foros del Web. Pues es eso, como hago para que todas las fuentes por default al crear sean por ejemplo "Tahoma" Aqui el codigo con el que trabajo. ...
  #1 (permalink)  
Antiguo 15/03/2005, 18:24
Avatar de thewayox  
Fecha de Ingreso: diciembre-2004
Ubicación: Guaro, Vzla
Mensajes: 189
Antigüedad: 19 años, 4 meses
Puntos: 3
Fuente Global para todos los textBoxs

Pues es eso, como hago para que todas las fuentes por default al crear sean por ejemplo "Tahoma"

Aqui el codigo con el que trabajo.

Código HTML:
//----------------------------------------------------------------------------------
// slideshow component | (c)2003 Armen Abrahamyan | http://abrahamyan.com
// please contact to author for commercial use 
//----------------------------------------------------------------------------------


#initclip
function slideshowClass() {
	this.init();
}
// 
slideshowClass.prototype = new MovieClip();
// initializing  
slideshowClass.prototype.init = function() {
	this.cnt = 0;
	//
	this.create_mc("bg_mc", 400, 260);
	//
	this.create_mc("up_mc", 400, this.title_h);
	this.up_mc._y = this.bg_mc._y-this.bg_mc._height/2-this.title_h/2-5;
	//
	this.cnt++;
	// creating container for loading images 
	this.createEmptyMovieClip("cont_mc", this.cnt);
	this.cont_mc._x = -1300;
	//
	this.mtextFormat = new TextFormat(this);
	this.mTextFormat.align = "left";
	this.mTextFormat.font = this.fname;
	this.mTextFormat.color = this.bcolor;
	this.mTextFormat.size = this.fsize;
	
	this.cont_mc._y = this.bg_mc._y-this.bg_mc._height/2;
	// use this.sp variable to change the speed of motion
	this.sp = 5;
	//------------------------------------------------------
	this.max_cnt = _root.slide_names.length;
	this.current_nm = 0;
	//
	
	this.show_title()
	this.create_next_btn("next_btn",50,this.title_h-4);
	this.create_prev_btn("prev_btn",50,this.title_h-4);
	this.next_btn._y=this.up_mc._y;
	this.next_btn._x=this.up_mc._width/2-this.next_btn._width/2-4
	this.prev_btn._y=this.up_mc._y;
	this.prev_btn._x=this.up_mc._width/2-2*this.next_btn._width
	this.show_loader();
	this.next_img();
};
slideshowClass.prototype.create_mc = function(nm, w, h) {
	this.createRect(nm, 0, 0, w, h, this.mcolor, this.bcolor);
};
//
slideshowClass.prototype.create_next_btn = function(nm, w, h) {
	this.create_mc(nm,w,h);
	this.cnt++;
	this[nm].createTextField("next_txt", this.cnt, -w/2, -h/2-3, w, h+4);
	this[nm].next_txt.type = "dynamic";
	// No se si sirve //this.mTextFormat.font = "Tahoma";
	this.mTextFormat.align = "right";
	this[nm].next_txt.selectable = "false";
	this[nm].next_txt.text = "Siguiente";
	this[nm].next_txt.setTextFormat(this.mtextFormat);
	this[nm].onRollOver=function(){
		this._alpha=50;	
	}
	this[nm].onRollOut=function(){
		this._alpha=100;	
	}
	this[nm].onPress=function(){
		
		this._alpha=100;
		this.clearInterval(this.loadComplate);
		this._parent.next_img();
		
	}
}
//
slideshowClass.prototype.create_prev_btn = function(nm, w, h) {
	this.create_mc(nm,w,h);
	
	this.cnt++;
	this[nm].createTextField("prev_txt", this.cnt, -w/2, -h/2-3, w, h+4);
	this[nm].prev_txt.type = "dynamic";
	this.mTextFormat.align = "left";
	this[nm].prev_txt.selectable = false;
	this[nm].prev_txt.text = "Anterior";
	this[nm].prev_txt.setTextFormat(this.mtextFormat);
	this[nm].onRollOver=function(){
		this._alpha=50;	
	}
	this[nm].onRollOut=function(){
		this._alpha=100;	
	}
	this[nm].onPress=function(){
		
		this._alpha=100;
		this.clearInterval(this.loadComplate);
		this._parent.current_nm -=2;
		if (this._parent.current_nm < 0) this._parent.current_nm =0;
		this._parent.next_img();
		
	}
}
slideshowClass.prototype.createRect = function(nm, x1, y1, w, h, mclr, bclr) {
	this.cnt++;
	this.createEmptyMovieClip(nm, this.cnt);
	this[nm].lineStyle(0, bclr, 100);
	this[nm].beginFill(mclr);
	this[nm].moveTo(x1-w*.5, y1-h*.5);
	this[nm].lineTo(x1+w*.5, y1-h*.5);
	this[nm].lineTo(x1+w*.5, y1+h*.5);
	this[nm].lineTo(x1-w*.5, y1+h*.5);
	this[nm].lineTo(x1-w*.5, y1-h*.5);
	this[nm].moveTo(x1, y1);
	this[nm].endFill();
};
slideshowClass.prototype.next_img = function() {
	//
	this.cont_mc._x = -1300;
	this.up_mc.title_txt.text = _root.slide_titles[this.current_nm];
	this.mTextFormat.align = "left";
	this.up_mc.title_txt.setTextFormat(this.mtextFormat);
	this.cont_mc.loadMovie(this.img_folder+_root.slide_names[this.current_nm]);
	this.current_nm++;
	if (this.current_nm>this.max_cnt-1) {
		this.current_nm = 0;
	}
	clearInterval(this.load_next);
	this.loadComplate = setInterval(this, "show_loading", 100);
};
slideshowClass.prototype.show_loading = function() {
	//
	var b_total = (this.cont_mc.getBytesTotal()/1024);
	var b_loaded = (this.cont_mc.getBytesLoaded()/1024);
	// dysplaying loading information
	this.load_txt.text="Cargando "+Math.floor(b_loaded)+" kb"+" de "+Math.floor(b_total)+" kb";
	this.mTextFormat.align = "center";
	this.load_txt.setTextFormat(this.mtextFormat);
	//
	if ((b_total == b_loaded) && (b_loaded>1)) {
		clearInterval(this.loadComplate);
		this.load_txt.text="";
		this.load_txt.setTextFormat(this.mtextFormat);
		
		this.scale(this.cont_mc._width, this.cont_mc._height);
		this.load_next = setInterval(this, "next_img", this.interval*1000);
	}
};
//  creating motion
slideshowClass.prototype.scale = function(nx, ny) {
	this.onEnterFrame = function() {
		//
		def_x = (nx-this.bg_mc._width)/this.sp;
		def_y = (ny-this.bg_mc._height)/this.sp;
		this.bg_mc._width += def_x;
		this.bg_mc._height += def_y;
		//
		this.up_mc._width = this.bg_mc._width;
		this.up_mc._y = this.bg_mc._y-this.bg_mc._height/2-this.title_h/2-5;
		this.next_btn._y=this.up_mc._y;
		this.next_btn._x=this.up_mc._width/2-this.next_btn._width/2-4
		this.prev_btn._y=this.up_mc._y;
		this.prev_btn._x=this.up_mc._width/2-2*this.prev_btn._width
		//
		if ((Math.abs(this.bg_mc._width-nx)<=.6) && (Math.abs(this.bg_mc._height-ny)<=.6)) {
			this.bg_mc._width = nx;
			this.bg_mc._height = ny;
			//
			this.up_mc._y = this.bg_mc._y-this.bg_mc._height/2-this.title_h/2-5;
			//
			this.cont_mc._x = this.bg_mc._x-this.bg_mc._width/2;
			this.cont_mc._y = this.bg_mc._y-this.bg_mc._height/2;
			//
			this.onEnterFrame = undefined;
		}
	};
};
slideshowClass.prototype.show_loader = function() {
	this.cnt++;
	this.createTextField("load_txt", this.cnt, -200, 0, 400, 40);
	this.load_txt.type = "dynamic";
	this.mTextFormat.align = "center";
	this.load_txt.selectable = false;
	this.load_txt.text = "";
	this.load_txt.setTextFormat(this.mtextFormat);
}
slideshowClass.prototype.show_title = function() {
	this.cnt++;
	this.up_mc.createTextField("title_txt", this.cnt, -this.up_mc._width/2+2, -this.up_mc._height/4-4, 400, 40);
	
	this.up_mc.title_txt.type = "dynamic";
	this.up_mc.title_txt.selectable = false;
	this.up_mc.title_txt.text = "";
	this.up_mc.title_txt.setTextFormat(this.mtextFormat);
}
//-----------
Object.registerClass("slideshow", slideshowClass);
#endinitclip
Ah, esto es un slideShow que lle desde un XML la info a mostrar.

Gracias
__________________
EL PODER CORROMPE, EL PODER ABSOLUTO CORROMPE ABSOLUTO. EL CONOCIMIENTO ES PODER MAS NO ES SABIDURIA, MANEJALO SABIAMENTE O TE CORROMPE
  #2 (permalink)  
Antiguo 16/03/2005, 16:03
Avatar de thewayox  
Fecha de Ingreso: diciembre-2004
Ubicación: Guaro, Vzla
Mensajes: 189
Antigüedad: 19 años, 4 meses
Puntos: 3
Ah! o sea, no se puede??
__________________
EL PODER CORROMPE, EL PODER ABSOLUTO CORROMPE ABSOLUTO. EL CONOCIMIENTO ES PODER MAS NO ES SABIDURIA, MANEJALO SABIAMENTE O TE CORROMPE
  #3 (permalink)  
Antiguo 16/03/2005, 16:30
Avatar de TMeister
Crazy Coder
 
Fecha de Ingreso: enero-2002
Ubicación: En la Oficina
Mensajes: 2.880
Antigüedad: 22 años, 3 meses
Puntos: 193
veamos...

Si es un componente me imagino que debe ser personalisable esto lo digo por estas lineas...

Código:
this.mtextFormat = new TextFormat(this);
this.mTextFormat.align = "left";
this.mTextFormat.font = this.fname;
this.mTextFormat.color = this.bcolor;
this.mTextFormat.size = this.fsize;
Que estan en la funcion init del componente...

hay 2 formas

1.- Desde la linea de tiempo donde tienes la instancia del componente pon:

Código:
Mi_componente.fname = "Tahoma"
o 2 editar el componente y cambiar la linea

Código:
this.mTextFormat.font = this.fname;
por

Código:
this.mTextFormat.font = "Tahoma";
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 11:32.