Pillola di And3a
esempio di pagina validata W3C
codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>SWF centrato verticalmente HTML 4.01 Transitional</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="robots" content="ALL">
<style type="text/css">
html, body {
margin: 0px;
padding: 0px;
width: 100%;
height: 100%;
}
table {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<table cellspacing="0" cellpadding="0">
<tr>
<td>
<object type="application/x-shockwave-flash" data="centered.swf" width="100%" height="300">
<param name="movie" value="centered.swf" />
</object>
</td>
</tr>
</table>
</body>
</html>
in questo caso il file centered.swf risultara' si largo 100% ma avra' in questo esempio un movieClip sempre centrato, provate voi stessi , questo e' il codice usato per questo esempio:
centered.swf
codice:
// STAGE PROPRIETIES
Stage.scaleMode = "noScale";
Stage.align = "TL";
// BLOCK TIMELINE
stop();
// MAIN MOVIE DEFINITIONS
var ms_width:Number = new Number( 400 );
var ms_height:Number = new Number( 170 );
var ms_brdColor:Number = 0xDEDEDE;
var ms_bgColor:Number = 0xF5F5F5;
// MAIN MOVIE CREATION
createEmptyMovieClip( 'myStage', getNextHighestDepth() );
with( myStage ) {
moveTo( 0, 0 );
lineStyle( 1, ms_brdColor, 100 );
beginFill( ms_bgColor, 100 );
lineTo( ms_width, 0 );
lineTo( ms_width, ms_height );
lineTo( 0, ms_height );
lineTo( 0, 0 );
endFill();
}
// FUNCTION TO CENTER MOVIE
var centerToStage:Function = function( mc:MovieClip ):Void {
mc._x = Math.floor( ( Stage.width / 2 ) - ( mc._width / 2 ) );
mc._y = Math.floor( ( Stage.height / 2 ) - ( mc._height / 2 ) );
}
myStage.centerInterval = setInterval( centerToStage, 50, myStage );
// TEXFIELD CREATION WITH TEXTFORMAT DECLARATION
myStage.createTextField( 'myTfield', myStage.getNextHighestDepth(), 10, 10, myStage._width, 0 );
myStage.myTfield.autoSize = true;
myStage.myTfield.multiline = true;
myStage.myTformat = new TextFormat();
myStage.myTformat.font = "_sans";
myStage.myTformat.size = 11;
myStage.myTformat.color = 0x006666;
// FUNCTION TO WRITE ON TEXTFIELD
var showStageInfo:Function = function( myTfield:TextField, myTformat:TextFormat ):Void {
myTfield.text = "Stage width: " + Stage.width + "\nStage height: " + Stage.height;
myTfield.setTextFormat( myTformat );
}
myStage.showStageInterval = setInterval( showStageInfo, 50, myStage.myTfield, myStage.myTformat );
Il risultato puoi vederlo on-line in questa pagina
http://www.3site.it/ESEMPI/SWF%20cen...3C%204.01.html