..:: MX Studio Fóruns ::..: como redimensionar site em flash? AS2 - ..:: MX Studio Fóruns ::..

Jump to content

Publicidade




ATENÇÃO

Para evitar posts desnecessários e que não influam para o andamento e desenvolvimento do fórum, clique aqui e leia todas as regras.
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

como redimensionar site em flash? AS2

#1 User is offline   darkslayert 

  • Group: Membros
  • Posts: 5
  • Joined: 11-November 10

Posted 11 October 2011 - 12:45 PM

Boas pessoal. É assim eu fiz um site todo em flash as2.0 com as medidas de 980px por 850px. É claro que na resolução do meu pc que é(1280*1024) eu vejo ele direitinho , o problema é ver ele em resolução mais pequenas, eu queria que ele se auto redimenciona-se para essas resoluções. Ja segui varios tutoriais mas sem êxito tais como
My link
My link

este é o index

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Teppan</title>
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
<style type="text/css">
<!--
#flash1 {
	height: 850px;
	width: 980px;
	margin-top: 0;
	margin-right: auto;
	margin-bottom: 0;
	margin-left: auto;
}
-->
</style>
</head>

<body>
<div class="flash" id="flash1">
  <object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="980px" height="850px">
    <param name="movie" value="25244.swf" />
    <param name="quality" value="high" />
    <param name="wmode" value="opaque" />
    <param name="swfversion" value="8.0.35.0" />
    <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
    <param name="expressinstall" value="Scripts/expressInstall.swf" />
    <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="25244.swf" width="100%" height="100%">
      <!--<![endif]-->
      <param name="quality" value="high" />
      <param name="wmode" value="opaque" />
      <param name="swfversion" value="8.0.35.0" />
      <param name="expressinstall" value="Scripts/expressInstall.swf" />
      <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
      <div>
        <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
        <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
      </div>
      <!--[if !IE]>-->
    </object>
    <!--<![endif]-->
  </object>
</div>
<script type="text/javascript">
<!--
swfobject.registerObject("FlashID");
//-->
</script>
</body>
</html>


e inseri na primeira layer do fla este código

Stage.align = "TL";
Stage.scaleMode = "noScale";
sizeListener = new Object();
sizeListener.onResize = function() {
centered._x = Stage.width/2
centered._y = Stage.height/2
centered._width = Stage.width * .5
};
Stage.addListener(sizeListener);


Mas não funciona, estarei a fazer algo errado? Por favor uma ajuda
0

#2 User is offline   Rodrigo Pixel 

  • Group: Moderadores
  • Posts: 1279
  • Joined: 07-May 07

Posted 11 October 2011 - 03:46 PM

No html a <div> que recebe seu arquivo swf, tem que estar com propriedades width e height com valor de "100%", assim quando o browser redimensionar, vai também redimensionar a <div> e consequentemente redimensionar o arquivo swf, com isso dispara o evento onResize.

Ex no html:
Supondo que seu arquivo swf chama onResize_as2.swf aplicado ao html. Gerei um HTML pelo próprio flash, que pode ficar assim pra funcionar o resize corretamente:
<!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>onResize_as2</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<style type="text/css" media="screen">
		html, body { height:100%; background-color: #ffffff;}
		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="onResize_as2" align="middle">
				<param name="movie" value="onResize_as2.swf" />
				<param name="quality" value="high" />
				<param name="bgcolor" value="#ffffff" />
				<param name="play" value="true" />
				<param name="loop" value="true" />
				<param name="wmode" value="window" />
				<param name="scale" value="noscale" />
				<param name="menu" value="false" />
				<param name="devicefont" value="false" />
				<param name="salign" value="lt" />
				<param name="allowScriptAccess" value="sameDomain" />
				<!--[if !IE]>-->
				<object type="application/x-shockwave-flash" data="onResize_as2.swf" width="100%" height="100%">
					<param name="movie" value="onResize_as2.swf" />
					<param name="quality" value="high" />
					<param name="bgcolor" value="#ffffff" />
					<param name="play" value="true" />
					<param name="loop" value="true" />
					<param name="wmode" value="window" />
					<param name="scale" value="noscale" />
					<param name="menu" value="false" />
					<param name="devicefont" value="false" />
					<param name="salign" value="lt" />
					<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>


Pra gerar o html pelo flash você utiliza o painel File > Publish settings, cria aba/guia HTML e configura como essa imagem:
http://www.developer.nokia.com/document/Mobile_Hands-on_Labs/Web/FlashLite/images/htmlPublishSettings.jpg


No flash, o código não está errado, mas pode melhorar um pouco:
//configura stage
Stage.align = "TL"; //alinha topo esquerdo do stage
Stage.scaleMode = "noScale"; //sem escala
Stage.addListener(this); //essa timeline pode ser o listener sem precisar criar objeto


redimensionaObjeto(); //já começa redimensionando 1º vez que carrega

this.onResize = redimensionaObjeto; //executa apenas quando(e somente quando) o stage sofrer alteração de tamanho

function redimensionaObjeto():Void
{
	//controla seu movieclip ou qualquer outro movieclip aqui...
	centered._x = Stage.width/2; //posição x, meio do stage
	centered._y = Stage.height/2; //posição y, meio do stage
	centered._width = Stage.width * .5; //largura de acordo com tamanho do stage
}


Arquivo CS4:
http://www.mediafire...7lidv38cf9cfr7d


Se tiver interesse mais pelo assunto vale apena conferir esses links. Embora seja em AS3, a lógica é praticamente a mesma pra AS2:
http://www.flashpedi...layout-liquido/
http://www.flashpedi...-e-fullbrowser/

Abraço.
0

#3 User is offline   darkslayert 

  • Group: Membros
  • Posts: 5
  • Joined: 11-November 10

Posted 11 October 2011 - 06:43 PM

Tentei da sua maneira mas não consigo que ele redimensione, sera que pode dar uma olha no meu fla e ver qual o erro. Muito obrigado
My link
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic



Publicidade




1 User(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)