Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

ana rob

[Resolvido] centralizar flash em html

Recommended Posts

Já tentei várias vezes e não estou conseguindo centralizar o flash no documento html.Tanto no flash, quanto na vizualização do site, aparece corretamente, mas após a publicação ele permanece no canto esquerdo do monitor...

 

Alguém pode me ajudar?

Compartilhar este post


Link para o post
Compartilhar em outros sites

Oi ana, tudo bem.

 

Eu aprendi a descartar o html gerado pelo Flash.

Crio uma nova página pelo DW e centralizo com CSS.

 

<title>Nome da página</title>
<style type="text/css"> 
<!--
body {
	background-color: #000; 
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	text-align: center;
}
-->
</style>

 

Abs

Compartilhar este post


Link para o post
Compartilhar em outros sites

Ou

<table align='center' width='100%' border='0' cellspacing='0' cellpadding='0'>
   <tr>
       <td align='center'>
          
           SWF AQUI
       
       </td>
   </tr>
</table>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Tabelas são para dados tabulares.

 

Ao inserir uma página swf pelo DW (Flash + DW CS4):

 

<body>
<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="980" height="550">
  <param name="movie" value="principal.swf" />
  <param name="quality" value="high" />
  <param name="wmode" value="transparent" />
  <param name="swfversion" value="6.0.65.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="principal.swf" width="980" height="550">
    <!--<![endif]-->
    <param name="quality" value="high" />
    <param name="wmode" value="transparent" />
    <param name="swfversion" value="6.0.65.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>
<script type="text/javascript">
<!--
swfobject.registerObject("FlashID");
//-->
</script>
</body>

O CSS centraliza o swf no corpo da página.

 

Se preferir use arquivo externo.

 

 

Abs.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Ainda não consegui com as opções acima, segue codigo para análise:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>index</title>
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="AC_RunActiveContent.js" language="javascript"></script>
</head>
<body bgcolor="#000000">
<!--url's used in the movie-->
<!--text used in the movie-->
<!--
loading... 000%
-->
<!-- saved from url=(0013)about:internet -->
<script language="javascript">
	if (AC_FL_RunContent == 0) {
		alert("This page requires AC_RunActiveContent.js.");
	} else {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', '940',
			'height', '800',
			'src', 'index',
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'bottom',
			'play', 'false',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'window',
			'devicefont', 'true',
			'id', 'index',
			'bgcolor', '#000000',
			'name', 'index',
			'menu', 'true',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', 'index',
			'salign', ''
			); //end AC code
	}
</script>
<noscript>
	<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="940" height="800" id="index" align="bottom">
	<param name="allowScriptAccess" value="sameDomain" />
	<param name="allowFullScreen" value="false" />
	<param name="movie" value="index.swf" /><param name="play" value="false" /><param name="quality" value="high" /><param name="devicefont" value="true" /><param name="bgcolor" value="#000000" />	<embed src="index.swf" play="false" quality="high" devicefont="true" bgcolor="#000000" width="940" height="800" name="index" align="bottom" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
	</object>
</noscript>
</body>
</html>

Compartilhar este post


Link para o post
Compartilhar em outros sites

<style type="text/css"> 
<!--
*{
	margin:0;
	padding:0;
}
body{
	background-color:#000;
	margin:0 auto;
	text-align:center;
}
-->
</style>

Acrescente este estilo antes do fechamento da tag "HEAD". E não se esqueça de definir um "!DOCTYPE" para a sua página.

 

Att.

Compartilhar este post


Link para o post
Compartilhar em outros sites

OK

 

Funcionou!!!Obrigada!

 

Você pode me ajudar com a outra dúvida sobre xml?Gostaria que aparecesse apenas um trecho da descrição, já que os textos são longos...

 

segue o codigo:

<?xml version="1.0" encoding="utf-8"?>
<items>
	<item>
		<title>ESTILO RUSTICO</title>
		<url>http://www.mullerarquitetura.com/</url>
		<target>_self</target>
		<description>xxxxx. </description>
	</item>
</items>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Quer mostrar apenas o início da descrição? E com um link para a descrição completa??

Se for isso, basta utilizar o método "substr", veja ex:

var my_str:String = new String("Este seria um exemplo para limitar caracteres de uma frase ou texto");
var mySubstring:String = new String();
mySubstring = my_str.substr(0,40)+"...";
trace(mySubstring);

Ou seja, neste exemplo está limitado a quantidade de apenas 40 caracteres começando pelo início da string (frase).

Para otimizar, pode jogar isto em uma função e chamar quando necessário, já que haverá a necessidade de chamar a descrição completa.

 

Att.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Não Joww, index é o html, é o nome padrão para ser usado no servidor.

 

O index.htm contém a página em Flash.

 

O swf normalmente recebe o nome de "principal.swf" ou "main.swf".

 

Observe:

 

<body>
<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="980" height="550">
     <param name="movie" value="principal.swf" /> // AQUI ESTÁ A PÁGINA SWF
     <param name="quality" value="high" /> 
     <param name="wmode" value="transparent" />

Outras informações são adicionadas no código html ao inserir um swf.

 

O CSS para centralizar o swf (numa página em Flash --> obs: layout líquido é outra história) é adicionado no index.html, tal qual foi mencionado acima.

 

Se necessário crie um tópico sobre o assunto. A gente ajuda no que puder.

 

 

Abs

Compartilhar este post


Link para o post
Compartilhar em outros sites

O codigo completo é este, onde coloco a substring?

var flashmo_item_list = new Array();
var flashmo_item_group:MovieClip = new MovieClip();

var item_width:Number = flashmo_mask.width;
var item_height:Number = 0;
var item_spacing:Number = 15;
var item_padding:Number = 10;

var i:Number;
var total:Number;
var flashmo_xml:XML = new XML();
var xml_loader:URLLoader = new URLLoader();
xml_loader.load(new URLRequest("flashmo_143_news_list.xml"));
xml_loader.addEventListener(Event.COMPLETE, push_array);

function push_array(e:Event):void 
{
	flashmo_xml = XML(e.target.data);
	total = flashmo_xml.item.length();

	for( i = 0; i < total; i++ )
	{
		flashmo_item_list.push( {
			title: flashmo_xml.item[i].title.toString(), 
			url: flashmo_xml.item[i].url.toString(), 
			target: flashmo_xml.item[i].target.toString(), 
			description: flashmo_xml.item[i].description.toString()
		} );
	}
	create_item_list();
}

function create_item_list():void
{
	for( i = 0; i < total; i++ )
	{
		var flashmo_item = new MovieClip();
		
		flashmo_item.addChild( create_item_title( flashmo_item_list[i].title ) );
		flashmo_item.addChild( create_item_desc( flashmo_item_list[i].description ) );
		flashmo_item.addChildAt( create_item_button( flashmo_item.height, i ), 0 );
		flashmo_item.addChildAt( create_item_bg( flashmo_item.height, i ), 0 );
		
		flashmo_item.y = item_height;
		item_height += flashmo_item.height + item_spacing;
		
		flashmo_item_group.addChild( flashmo_item );
	}
	
	this.addChild( flashmo_item_group );
	flashmo_mask.width = item_width;
	flashmo_item_group.mask = flashmo_mask;
	
	flashmo_sb.scrolling("flashmo_item_group", "flashmo_mask", 0.50);	// ScrollBar Added
}

function create_item_button( h:Number, item_no:Number )
{
	var fm_button = new flashmo_news_button();
				
	fm_button.x = item_padding;
	fm_button.y = h + item_padding * 2;
	fm_button.name = "flashmo_" + item_no;
	fm_button.addEventListener( MouseEvent.CLICK, goto_URL );
	
	return fm_button;
}

function goto_URL(me:MouseEvent)
{
	var url_button:SimpleButton = me.target as SimpleButton;
	var no:Number = parseInt( url_button.name.slice(8,10) );
	navigateToURL( new URLRequest( flashmo_item_list[no].url ), flashmo_item_list[no].target );
}

function create_item_bg( h:Number, item_no:Number )
{
	var fm_rect:Shape = new Shape();
	
	if( item_no % 2 == 0 )
		fm_rect.graphics.beginFill(0x181818, 1);	// ITEM BACKGROUND COLOR 1
	else
		fm_rect.graphics.beginFill(0x242424, 1);	// ITEM BACKGROUND COLOR 2
		
	fm_rect.graphics.drawRoundRect(0, 0, item_width, h + item_padding * 2, 0);
	fm_rect.graphics.endFill();
	
	return fm_rect;
}

function create_item_title( item_title:String )
{
	var fm_text = new TextField();
	
	fm_text.defaultTextFormat = fm_title_format;
	fm_text.x = fm_text.y = item_padding;
	fm_text.width = item_width - item_padding * 2;
	fm_text.text = item_title;
	fm_text.selectable = false;
	fm_text.autoSize = TextFieldAutoSize.LEFT;
	
	return fm_text;
}

function create_item_desc( item_desc:String )
{
	var fm_text = new TextField();
	
	fm_text.defaultTextFormat = fm_desc_format;
	fm_text.x = item_padding;
	fm_text.y = 25 + item_padding;
	fm_text.width = item_width - item_padding * 2;
	fm_text.text = item_desc;
	fm_text.multiline = true;
	fm_text.wordWrap = true;
	fm_text.selectable = false;
	fm_text.autoSize = TextFieldAutoSize.LEFT;
	
	return fm_text;
}

var fm_title_format:TextFormat = new TextFormat();
fm_title_format.font = "Arial";
fm_title_format.color = 0xCCFF00;	// TITLE TEXT COLOR
fm_title_format.size = 14;
fm_title_format.bold = true;

var fm_desc_format:TextFormat = new TextFormat();
fm_desc_format.font = "Arial";
fm_desc_format.color = 0xCCCCCC;	// DESCRIPTION TEXT COLOR
fm_desc_format.size = 12;
fm_desc_format.align = TextFormatAlign.JUSTIFY;
fm_desc_format.leading = 2;

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.