Este script genera un menú horizontal cuyos botones se ajustan el ancho del navegador.
Actionscript:
-
Stage.scaleMode = 'noScale';
-
Stage.align = 'TL';
-
formato = new TextFormat();
-
formato.font = 'verdana';
-
formato.size = 10;
-
function makeBoton(tmp_mc, ancho, largo, p, col, label) {
-
var tm_mc = tmp_mc.createEmptyMovieClip("tempo" + p, p);
-
tm_mc.beginFill(col);
-
tm_mc.lineTo(0, 0);
-
tm_mc.lineTo(0 + ancho, 0);
-
tm_mc.lineTo(0 + ancho, 0 + largo);
-
tm_mc.lineTo(0, 0 + largo);
-
tm_mc.lineTo(0, 0);
-
tm_mc.createTextField("label_txt", p + 100, 5, 0, 0, 0);
-
tm_mc.label_txt.text = label;
-
tm_mc.label_txt.autoSize = true;
-
tm_mc.label_txt.setTextFormat(formato);
-
tm_mc.onRollOver = function() {
-
this.label_txt.textColor = 0xffffff;
-
};
-
tm_mc.onRollOut = function() {
-
this.label_txt.textColor = 0x000000;
-
};
-
tm_mc.onRelease = function() {
-
};
-
return tm_mc;
-
}
-
function init() {
-
Stage.scaleMode = "noScale";
-
liste = new Object();
-
liste.onResize = size;
-
Stage.addListener(liste);
-
clips = [];
-
basex = 0;
-
menu_mc = createEmptyMovieClip("menu", 1);
-
label_array = ["Uno", "Dos", "Tres", "Cuatro", "Cinco", "Seis"];
-
for (var i = 0; i <label_array.length; i++) {
-
var clip = makeBoton(menu_mc, 70, 15, i, "0xc1c1c1", label_array[i]);
-
clip._x = basex;
-
clips.push(clip);
-
basex += clip._width;
-
}
-
size();
-
}
-
function size() {
-
basex = 0;
-
tamanio = Stage.width / label_array.length;
-
for (var i = 0; i <clips.length; i++) {
-
clips[i]._x = basex;
-
basex += tamanio + 2;
-
clips[i]._width = tamanio;
-
}
-
}
-
init();
Publicar
Dimensiones: Porcentaje
Escalar:No escalar
Descarga Resizable Menu.zip
Resizable Menu.zip se ha descargado 344 veces.

Cool