Graphics Reference
In-Depth Information
that will fire off both when your .swf loads and when it fails
to load.
Further down the code is the div tag that contains the object
element in which your .swf content will be seen. Obviously, your
.swf is taken care of in the param tag named
movie ,
but what
'
s
up with the other object inside the object? Simply put, that
'
sthe
fail-safe for your ad. If the users don
'
t have Flash installed or sim-
ply have it blocked, they
ll end up seeing whatever content you put
in this element, and that
'
s where the alternate content or default
image comes in. Another cool thing about that particular object
element is that in addition to being able to show a default image
for banners, you can also use it to make your sites more readily
available to search engines. But let
'
'
s wait until Chapter 9 to get
into that.
Before we move on, we still need to take a look at the dynamic
method of SWFObject. A quick quote from the documentation
states that
'
s dynamic embed method follows the prin-
ciple of progressive enhancement and replaces alternative HTML
content for Flash content when enough JavaScript and Flash plug-
in support is available.
SWFObject
Again, there are pros and cons to using
either method, but if you like less HTML, this one
'
sforyou.Just
check out Example 3.8.
EXAMPLE 3.8
Using SWFObject
'
s dynamic method
< script type= text/javascript src= swfobject.js >< /script >
< script type= text/javascript >
swfobject.embedSWF( 300x250_30_my_ad.swf , myBanner ,
300 , 250 , 10.0.0 );
< /script >
< div id= myBanner >
< p > Alternative content < /p >
< /div >
As you can see, the explanation of this one is going to be much
shorter. For this dynamic method, we don
tuse swfobject.register
Object .Instead,weusethe swfobject.embedSWF method, which
requires a few more parameters. While there are other optional para-
meters that can be used with the embedSWF method (such as flashvars
and attributes ), let
'
s just look at the five required parameters listed
in the example. All five of them are expecting Strings, and the first
one is the URL of your .swf. The second parameter is the name of
the div in which to show your .swf content, and the third and fourth
'
Search WWH ::




Custom Search