Os pongo el codigo del archivo labels.as por si sirve de ayuda:
//
//
// CLASE DE ETIQUETAS V1.3
//
// POR RAÚL JIMÉNEZ (ELECASH) --> www.elecash.org/blog
// Utiliza estas etiquetas como te de la gana, son totalmente libres de derechos.
//
// FOROS DE SOPORTE --> www.cristalab.com/foros
//
//
class Labels {
private var tipo:TextFormat;
private var color_txt, label_txt, tipoGrafia, clrTexto, clrFondo, clrLinea:String;
private var nLin, alto, ancho, tamanoTexto:Number;
private var sombraLab:Boolean;
//----------- CONSTRUCTOR -------------//
function Labels() {
this.clrFondo = "0xFFFFFF";
this.clrLinea = "0x000000";
this.clrTexto = "0x000000";
this.tamanoTexto = 11;
this.tipoGrafia = "Arial";
}
//----------- MÉTODOS -----------------//
//Método: Mostrar la etiqueta
public function mostrarLabel(txt:String, sombra:Boolean) {
//Cogemos las variables que le hemos pasado
label_txt = txt;
sombraLab = sombra;
//Colocamos la etiqueta en donde esta el ratón
var alMoverRaton:Object = new Object();
alMoverRaton.onMouseMove = function(){
_root["caja_txt"].texto_txt._x = _root._xmouse+10;
_root["caja_txt"].texto_txt._y = _root._ymouse+10;
//Controlamos que no se salga del escenario
if ((_root["caja_txt"].texto_txt._x + _root["caja_txt"].texto_txt._width) > Stage.width){
_root["caja_txt"].texto_txt._x = _root._xmouse - ((_root._xmouse + _root["caja_txt"].texto_txt._width) - Stage.width);
}
if ((_root["caja_txt"].texto_txt._y + _root["caja_txt"].texto_txt._height) > Stage.height){
_root["caja_txt"].texto_txt._y = _root._ymouse - ((_root._ymouse + _root["caja_txt"].texto_txt._height) - Stage.height);
}
_root["sombra_mc"]._x = _root["caja_txt"].texto_txt._x + 5;
_root["sombra_mc"]._y = _root["caja_txt"].texto_txt._y + 5;
}
Mouse.addListener(alMoverRaton);
//Creamos un contenedor y su caja de texto. La caja la colocamos en -300, para
//que no se vea donde se crea.
_root.createEmptyMovieClip("caja_txt", _root.getNextHighestDepth());
_root["caja_txt"].createTextField("texto_txt", 1048575, -300, 0, 150, 16);
//Colores
_root["caja_txt"].texto_txt.background = true;
_root["caja_txt"].texto_txt.backgroundColor = this.clrFondo;
_root["caja_txt"].texto_txt.border = true;
_root["caja_txt"].texto_txt.borderColor = this.clrLinea;
//Propiedades de la caja de texto
_root["caja_txt"].texto_txt.html = true;
_root["caja_txt"].texto_txt.multiline = true;
_root["caja_txt"].texto_txt.wordWrap = true;
_root["caja_txt"].texto_txt.selectable = false;
_root["caja_txt"].texto_txt.autoSize = "center";
//Ponemos el texto en la caja
_root["caja_txt"].texto_txt.htmlText = label_txt;
//Aplicamos formato a la tipografia
tipo = new TextFormat();
tipo.font = this.tipoGrafia;
tipo.size = this.tamanoTexto;
tipo.color = this.clrTexto;
tipo.align = "center";
_root["caja_txt"].texto_txt.setTextFormat(tipo);
//Si tiene más de 50 caracteres le ponemos un ancho fijo de 250
if (label_txt.length > 55){
ancho = 110;
tipo.align = "center";
_root["caja_txt"].texto_txt.autoSize = "center";
_root["caja_txt"].texto_txt._width = ancho;
alto = _root["caja_txt"].texto_txt._height - 14;
_root["caja_txt"].texto_txt.setTextFormat(tipo);
}
else{
ancho = _root["caja_txt"].texto_txt._width;
alto = _root["caja_txt"].texto_txt._height - 14;
}
//Añadimos la sombra si es necesario
if (sombraLab == true){
//Creamos la sombra
_root.createEmptyMovieClip("sombra_mc", _root.getNextHighestDepth());
_root["sombra_mc"].swapDepths(_root["caja_txt"]);
_root["sombra_mc"]._x = -300;
_root["sombra_mc"].beginFill (0x666666, 100);
_root["sombra_mc"].moveTo (0, 0);
_root["sombra_mc"].lineTo (ancho, 0);
_root["sombra_mc"].lineTo (ancho, alto);
_root["sombra_mc"].lineTo (0, alto);
_root["sombra_mc"].lineTo (0, 0);
_root["sombra_mc"].endFill();
_root["sombra_mc"]._alpha = 25;
}
}
//Método: Escondemos la etiqueta
public function quitarLabel() {
_root["caja_txt"].removeMovieClip();
_root["sombra_mc"].removeMovieClip();
}
//----------- GETTERS Y SETTERS -------------//
//Color del texto
public function set colorTexto(clrTxt:String):Void {
this.clrTexto = clrTxt;
}
public function get colorTexto():String {
return this.clrTexto;
}
//Color del fondo
public function set colorFondo(clrFnd:String):Void {
this.clrFondo = clrFnd;
}
public function get colorFondo():String {
return this.clrFondo;
}
//Color de la linea
public function set colorLinea(clrLin:String):Void {
this.clrLinea = clrLin;
}
public function get colorLinea():String {
return this.clrLinea;
}
//Tipografía
public function set tipoTexto(tipoTxt:String):Void {
this.tipoGrafia = tipoTxt;
}
public function get tipoTexto():String {
return this.tipoGrafia;
}
//Tamaño del texto
public function set tamTexto(tamTxt:Number):Void {
this.tamanoTexto = tamTxt;
}
public function get tamTexto():Number {
return this.tamanoTexto;
}
}
Os pongo el codigo que tengo en la pelicula externa, que esta en el nivel 101:
import Labels;
var label1:Labels = new Labels();
var label2:Labels = new Labels();
//Propiedades
label1.colorTexto = "0x000000";
label1.colorFondo = "0x8E8E8E";
label1.colorLinea = "0x000000";
label1.tipoTexto = "Arial";
//label1.tamTexto = 10;
//Eventos
madrid.onRollOver = function() {
label1.mostrarLabel("Prueba 1");
};
madrid.onRollOut = function() {
label1.quitarLabel();
};
ciudadreal.onRollOver = function() {
label1.mostrarLabel("Prueba 2);
};
ciudadreal.onRollOut = function() {
label1.quitarLabel();
};
stop();
