( How to correctly insert a Flash into XHTML )
1. Yöntem
( Solution )
Bilindiği üzere w3 standaları özellikle xhtml 1, 1,1 standartlarına uygun geçerli sayfalar hazırlanırken flash öğelerde sorun çıkıyor. Xhtml flashda uygulanan tagları yer hatası veriyordu.
SWFObject : Javascript Flash Player detection and embed script
SWFObject adlı küçük bir java script ve html kodu ile bu sorun ortadan kalkıyor ve güzel arayüzler ortaya çıkıyor.
SWFObject programcığının son sürümü şu an itibariyle 1.5 (08 mayıs 2007)
http://blog.deconcept.com/swfobject/swfobject.zip bu adresten indirebilir,
http://blog.deconcept.com/ bu blog sayfasından ayrıntılı bilgilere ulaşabilirsiniz. Aşağıda ise örnek kodlar verilmekte;
1. swfobject.js dosyası
2. test.html sayfamız örneği :
Kod: Tümünü seç
<!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="tr">
<head>
<meta content="text/html; charset=UTF-8"
http-equiv="content-type" />
<title>SWFObject</title>
<meta content="Murat Esgin" name="author" />
<meta content="SWFObject" name="description" />
<script type="text/javascript" src="swfobject.js"></script>
<style type="text/css">
body {
background-color: #eeeeee;
font: .8em/1.3em verdana,arial,helvetica,sans-serif;
}
#info {
width: 300px;
overflow: auto;
}
#flashcontent {
border: solid 1px #000;
width: 300px;
height: 300px;
float: left;
margin: 15px 20px;
}
</style>
</head>
<body>
<div id="flashcontent">
<strong>You need to upgrade your Flash Player</strong>
This is replaced by the Flash content.
Place your alternate content here and users without the Flash plugin or with
Javascript turned off will see this. Content here allows you to leave out <code>noscript</code>
tags. Include a link to <a href="swfobject.html?detectflash=false">bypass the detection</a> if you wish.
</div>
<script type="text/javascript">
// <![CDATA[
var so = new SWFObject("so_tester.swf", "sotester", "300",
"300", "8", "#FF6600");
so.addVariable("flashVarText", "this is passed in via
FlashVars for example only"); // this line is optional, but this example
uses the variable and displays this text inside the flash movie
so.write("flashcontent");
// ]]>
</script>
<div id="info">
<p>
This Flash movie was embedded using the <a href="http://blog.deconcept.com/swfobject/">SWFObject</a> embed
method by <a href="http://blog.deconcept.com/">Geoff Stearns</a>.
</p>
<p>Other sample embeds:</p>
<ul>
<li>Basic Flash Embed with alternate content</li>
<li><a href="fullpage.html">Full page Flash embed</a></li>
<li><a href="expressinstall.html">Basic Flash Embed with Express Install allowed</a></li>
</ul>
<p>You can also <a href="flashversion.html">view your installed
Flash version</a>.</p>
<p>
<a href="view-source:http://blog.deconcept.com/swfobject/swfobject.html">
View source</a> (in mozilla, firefox) | <a href="swfobject_source.js">View Javascript</a>.
</p>
<p>
<a href="http://blog.deconcept.com/swfobject/swfobject1-4.zip">Download Source</a>.
</p>
</div>
<p style="clear: both;margin-left: 20px"><a href="http://validator.w3.org/check?uri=referer">Validate XHTML</a> and
<a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a></p>
</body>
</html>