tipo....fiz todo meu menu em flash e em AS2....soh que eu queria que ele se adaptace a resolução do navegador q o usuarios estiver usando..seja 800x600 seja 1550x748 ...e só achei esse codigo em AS3 (codigozinho complicado por sinal
seguem os codigos:
Codigo dos butoes do menu:
on (releaseOutside, rollOver) {
a = !a;
bt2.play();
}
on (release) {
bt2.nextFrame();
}
on (rollOut) {
a = !a;
if (bt2._currentframe == 14) {
bt2.gotoAndPlay(17);
} else {
bt2.play();
}
if (bt2._currentframe == 13) {
bt2.gotoAndPlay(18);
} else {
bt2.play();
}
if (bt2._currentframe == 12) {
bt2.gotoAndPlay(19);
} else {
bt2.play();
}
if (bt2._currentframe == 11) {
bt2.gotoAndPlay(20);
} else {
bt2.play();
}
if (bt2._currentframe == 10) {
bt2.gotoAndPlay(21);
} else {
bt2.play();
}
if (bt2._currentframe == 9) {
bt2.gotoAndPlay(22);
} else {
bt2.play();
}
if (bt2._currentframe == 8) {
bt2.gotoAndPlay(23);
} else {
bt2.play();
}
if (bt2._currentframe == 7) {
bt2.gotoAndPlay(24);
} else {
bt2.play();
}
if (bt2._currentframe == 6) {
bt2.gotoAndPlay(25);
} else {
bt2.play();
}
if (bt2._currentframe == 5) {
bt2.gotoAndPlay(26);
} else {
bt2.play();
}
if (bt2._currentframe == 4) {
bt2.gotoAndPlay(27);
} else {
bt2.play();
}
if (bt2._currentframe == 3) {
bt2.gotoAndPlay(28);
} else {
bt2.play();
}
}
on (press) {
bt2.gotoAndPlay("down");
getURL("http://maxpresi.ucoz.com/news/downloads/1-0-2", "_self");
}
Agora o codigo pra fazer o swf se adaptar a janela =D
// todos los clips ajustables deben tener su origen
// en su esquina superior inquierda
// ajustes iniciales -----------------
// no queremos que se cambie la escala de la película
Stage.scaleMode = "noScale";
// la peli se ajusta arriba a la izquierda
Stage.align = "TL";
// definimos el tamaño mínimo de la peli
ancho_minimo = 600;
alto_minimo = 400;
// en este array almaceno los clips que se tienen
// que ajustar al cambiar el tamaño de la pantalla
clips_ajustables = new Array();
// definimos el objeto que va a detectar el cambio de tamaño
myListener = new Object();
// asociamos el objeto al stage para detectar los cambios
// de tamaño del stage
Stage.addListener(myListener);
// ejecuto la función rec al cambiar el tamaño
myListener.onResize = rec;
function rec() {
// definimos el alto y ancho que queda
// después de reescalar, si no alcanza
// los mínimos, asignamos éstos
alto = Stage.height;
if (alto<alto_minimo) {
alto = alto_minimo;
}
ancho = Stage.width;
if (ancho<ancho_minimo) {
ancho = ancho_minimo;
}
for (var g = 0; clips_ajustables[g]; g++) {
clips_ajustables[g].alinear();
}
}
// resolución total
//altoTotal = System.capabilities.screenResolutionY;
//anchoTotal = System.capabilities.screenResolutionX;
//alto = stage.height;
//ancho = stage.width;
// con esta función implemento el método setTipo
// en todos los movieClip.
// Los valores para ajuste_x son "izquierda", "derecha" y "centrar"
// Los valores para ajuste_y son "arriba", "abajo" y "centrar"
// Los valores para ajuste_width son false y un número que
// indica el porcentaje de la anchura del clip respecto de la escena
// Los valores para ajuste_height son false y un número que
// indica el porcentaje de la altura del clip respecto de la escena
MovieClip.prototype.setAjuste = function(ajuste_x, ajuste_y, ajuste_width, ajuste_height) {
// estos ajustes nos dicen como se tiene modificar el
// el clip al redimensionar
this.ajuste_x = ajuste_x;
this.ajuste_y = ajuste_y;
this.ajuste_width = ajuste_width;
this.ajuste_height = ajuste_height;
// almaceno la posición y el tamaño
// iniciales de los clips ajustables
this.x0 = this._x;
this.y0 = this._y;
this.w0 = this._width;
this.h0 = this._height;
this.ajustePersonalizado = false;
// almaceno el clip en el array
clips_ajustables.push(this);
this.alinear();
};
// función para alinear los clips en funcion de su tipo
MovieClip.prototype.alinear = function() {
// si se le ha pasado el parámetro ajuste_width en la función
// setAjuste, significa que debo ajustar el ancho del clip
// cuando reescalo la pantalla
if (this.ajuste_width) {
if (this.ajuste_width.indexOf("%") != -1) {
// si el valor de this.ajuste_width es un porcentaje
this._width = (_root.ancho*parseInt(this.ajuste_width))/100;
} else {
// si el valor de this.ajuste_width es un número de píxeles
this._width = this.ajuste_width;
}
}
// lo mismo con el ajuste del alto del clip
if (this.ajuste_height) {
if (this.ajuste_height.indexOf("%") != -1) {
this._height = (_root.alto*parseInt(this.ajuste_height))/100;
} else {
this._height = this.ajuste_height;
}
}
// ajustes de posicion de los clips
if (this.ajuste_x == "izquierda") {
this._x = this.x0;
}
if (this.ajuste_x == "derecha") {
this._x = Math.round(this.x0+(_root.ancho-_root.ancho_minimo));
}
if (this.ajuste_x == "centrar") {
this._x = Math.round((_root.ancho-this._width)*0.5);
}
if (this.ajuste_y == "arriba") {
this._y = this.y0;
}
if (this.ajuste_y == "abajo") {
this._y = Math.round(this.y0+(_root.alto-_root.alto_minimo));
}
if (this.ajuste_y == "centrar") {
this._y = Math.round((_root.alto-this._height)*0.5);
}
// si el clip tiene un ajuste especial ejecuto su función ajustar
// que hemos definido en el onClipEvent(load) del clip
if (this.ajustePersonalizado) {
this.ajustar();
}
};
(passei com os coments mesmo pra ver se ajuda vcs ae ai vcs decidem o q é mais facil...converter o codigo do botao ou o de adaptar a tela =D
p.s.: eu fiz o projeto todo em tamanho máximo, eu axo: 1550x200...vlw =D
__________________________________________________________________________________________________________
EDIT!
consegui dar recize...soh q em HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>head</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css" media="screen">
html, body { height:100%; background-color: #000000;}
body { margin:0; padding:0; overflow:hidden; }
#flashContent { width:100%; height:100%; }
</style>
</head>
<body>
<div id="flashContent">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="100%" height="100%" id="head" align="top">
<param name="movie" value="head.swf" />
<param name="quality" value="best" />
<param name="bgcolor" value="#000000" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="100%" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="sameDomain" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="head.swf" width="100%" height="100%">
<param name="movie" value="head.swf" />
<param name="quality" value="best" />
<param name="bgcolor" value="#000000" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="100%" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="sameDomain" />
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflash">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
</body>
</html>simplesmente coloquei o width e o height em 100% e funfo numa boa
nao sei se no site vai funfar tbm...mas tenho q terminar a animação do head ainda...soh fiz o menu =D
se quizerem dar uma olhada soh falar que eu upo os arquivos
vlw!
Edição feita por: MaxPresi, 08/01/2011, 10:55.










