Archive for the ‘Flash Links’ Category

Flash Movies as Backgrounds

20

Oct
13

Ever wondered how to set a flash movie as your website background? Well here’s a simple approach that can be used.

The following tutorial will guide you through the process of “layering” a page in a way to give the appearance of a flash background.

The are however a couple of points that are worth noting.  These include:

  • Absolute positioning is used to add content above the flash movie.  This therefore mean that the content is taken out of the flow of the document and when resizing the page content may be cut off unless a good workaround is used.
  • UFO (Unobtrusive Flash Objects) is used to embed the flash background although you could, and probably should, use SWFObject instead.

flash background HTML

The HTML below provides a simple structure and can be broken in to two sections, a div with id “flash-background” (used to house the flash background) and a second div with an id of “website” (contains your site content).

<div id=”flash-background”></div>
<div id=”website”>
<div class=”text-content”>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras porta sem et ligula. Nunc nec neque. Ut nec justo non lorem porttitor dictum. Etiam nec dui et odio egestas ornare. Quisque magna augue, tristique vel, egestas ac, lacinia et, purus. Curabitur varius. Sed tempor. Integer bibendum leo at urna. Ut tortor. Cras lobortis justo non lacus.</p>

<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras porta sem et ligula. Nunc nec neque. Ut nec justo non lorem porttitor dictum. Etiam nec dui et odio egestas ornare. Quisque magna augue, tristique vel, egestas ac, lacinia et, purus. Curabitur varius. Sed tempor. Integer bibendum leo at urna. Ut tortor. Cras lobortis justo non lacus.</p>

<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras porta sem et ligula. Nunc nec neque. Ut nec justo non lorem porttitor dictum. Etiam nec dui et odio egestas ornare. Quisque magna augue, tristique vel, egestas ac, lacinia et, purus. Curabitur varius. Sed tempor. Integer bibendum leo at urna. Ut tortor. Cras lobortis justo non lacus.</p>

<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras porta sem et ligula. Nunc nec neque. Ut nec justo non lorem porttitor dictum. Etiam nec dui et odio egestas ornare. Quisque magna augue, tristique vel, egestas ac, lacinia et, purus. Curabitur varius. Sed tempor. Integer bibendum leo at urna. Ut tortor. Cras lobortis justo non lacus.</p>

<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras porta sem et ligula. Nunc nec neque. Ut nec justo non lorem porttitor dictum. Etiam nec dui et odio egestas ornare. Quisque magna augue, tristique vel, egestas ac, lacinia et, purus. Curabitur varius. Sed tempor. Integer bibendum leo at urna. Ut tortor. Cras lobortis justo non lacus.</p>
</div>
</div>

flash background CSS

The CSS below is not very complex.  Set your default styling on the body I.e. font size, colour etc. The flash background div is positioned absolutely in the centre of the page with a z-index of 0 and website div is also positioned in the centre of the page with a z-index of 10000 (obviously doesn’t have to be that high I just wanted to show that it was larger :-) ).  CSS wise that is it, not very difficult at all.

body{
margin:0px;
padding:0px;
background-color:#666666;
font-family:arial;
font-size:80%;
color:#333333;
overflow:hidden;
}
#flash-background{
width:1014px;
height:960px;
text-align:left;
margin:0px auto;
position:absolute;
top:0px;
left:50%;
margin-left:-507px;
z-index:0;
}

#website{
width:800px;
height:400px;
text-align:left;
margin:30px auto;
position:relative;
z-index:10000;
background-image:url(images/overlay.png);
background-repeat:no-repeat;
}

.text-content{
padding:15px;
}

JavaScript

Finally we need to embed the flash movie into the page, in the example below I have used UFO, however, I would strongly advise you to use SWFObject 2.0 as this is currently the best solution in the market.

var FO = { movie:"flash/background.swf", width:"1014", height:"960", majorversion:"8", build:"0", xi:"true", wmode:"transparent" };
UFO.create(FO, "flash-background");

demo

Flash background demo.

download

Flash background download.

Flash Tutorials

4

Oct
10

I have recently been looking for some good flash tutorials to help me build a 3D Flash Carousel and came across a site called GOTOANDLEARN.COM.  This site provides some awesome video tutorials from 3D Carousels to preloading external SWF files.

I really recommend this site so check it out.

Masking a Flash Movie in HTML using a DIV

16

Jun
20

This is not something that is required in day to day development, but nether the less is definitely handy to know.

Due to the nature of embedded flash it does not seem possible to “mask” it using an overflow hidden on a containing DIV. This however is not the case.

By simply adding the following parameters a flash movie can be masked:

<param name="wmode" value="transparent" />

<embed src="andrewsellick.swf" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="550" height="150"></embed>

The wmode parameters bring the flash movie back into the flow of the document and therefore allow it to be treated as if it were for example an image.

The complete code I have used in the example is as follows:

code

css

#flash-mask{
width:30%;
overflow:hidden;
padding:10px 0px;
border:1px solid #cccccc;
}

The CSS as shown above is very simple and sets a width on a containing DIV to 30% of the page width as well as having an overflow set to hidden. This will simply demonstrate the effect clearly.

html

<div id="flash-mask">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="550" height="150">
<param name="movie" value="andrewsellick.swf" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<embed src="andrewsellick.swf" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="550" height="150"></embed>
</object>
</div>

As can be seen above there isnothing special here. Simply a containing DIV with a flash movie embeded and of course the parameters set.

example

Please have a look at the Masking a Flash Movie in HTML using a DIV example.

download

Feel free to try it out yourself with the Masking a Flash Movie in HTML using a DIV download.