Page 1 of 1

Addindg a Flash object.

Posted: Wed Aug 12, 2009 11:13 pm
by seanjohn
Hie,

Ken u assist me i would like to add a Flash ad on my template, how do i do it?

O0

Re: Addindg a Flash object.

Posted: Wed Aug 12, 2009 11:38 pm
by Qphoria
depends where you want it. it goes in the catalog/view/theme/default/template/*tpl file that you want it to show up on (home, header, etc)

Re: Addindg a Flash object.

Posted: Thu Aug 13, 2009 3:59 am
by piseth
I have no background of HTML but just a flash file so is there any sample codes to place in the header?

Thanks,
Piseth :)

Re: Addindg a Flash object.

Posted: Fri Aug 14, 2009 1:08 am
by CodeBits
The code to embed Flash into a page;
NOTE: this will not validate, but it will work. If you want it to validate keep reading.

Code: Select all

  <object
  classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,79,0"
  id="slideshowbanner"
  width="768" height="170">
  <param name="movie" value="yourfile.swf">
  <param name="bgcolor" value="#336699">
  <param name="quality" value="high">
  <param name="loop" value="false">
  <param name="menu" value="false">
  <param name="wmode" value="transparent">
  <param name="allowscriptaccess" value="samedomain">
  <embed
    type="application/x-shockwave-flash"
    pluginspage="http://www.macromedia.com/go/getflashplayer"
    name="movie"
    width="768" height="170"
    src="yourfile.swf"
    bgcolor="#336699"
    quality="high"
    loop="false"
    menu="false"
    wmode="transparent"
    swliveconnect="true"
    allowscriptaccess="samedomain">
    <noembed>
    </noembed>
  </embed>
</object>
To embed Flash or any other multimedia content you need a little javascript. There are several free scripts to do this task, one I use is flashfix.js and is very easy to use, you can set any number of embedded media with it on one page by using unique naming conventions of the id, and it validates with W3C standards.

Example;
flashfix.js

Code: Select all

function writeFlash(id) {
document.getElementById(id).innerHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,79,0' id='pan' width='760' height='100'><param name='movie' value='pan.swf'><param name='bgcolor' value='#FFFFFF'><param name='quality' value='high'><param name='loop' value='false'><param name='menu' value='false'><param name='wmode' value='transparent'><param name='allowscriptaccess' value='samedomain'><embed type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' name='pan' width='760' height='100' src='pan.swf' bgcolor='#FFFFFF' quality='high' loop='false' menu='false' wmode='transparent' swliveconnect='true'  allowscriptaccess='samedomain'></embed></object>";
}
The web page;

Code: Select all

<div id="flash_container"></div>

<script type="text/javascript">
writeFlash('flash_container');
</script>
And add this to the head of your document;

Code: Select all

<script type="text/javascript" src="flashfix.js"></script>
That's it... ;)

Re: Addindg a Flash object.

Posted: Fri Aug 14, 2009 1:26 am
by Qphoria
You need javascript for embedded flash? Since when?

Re: Addindg a Flash object.

Posted: Fri Aug 14, 2009 1:27 am
by Leon
Qphoria wrote:You need javascript for embedded flash? Since when?
Exactly my thoughts

Re: Addindg a Flash object.

Posted: Fri Aug 14, 2009 2:59 am
by CodeBits
If you read my post, I state, [ IF you want your page to Validate to W3C Standards ]
I should add that it's the embed tag that causes the problem, if you omit the embed tag you should validate ok, but some older browsers may not see your media.

reference:
http://www.v7n.com/forums/coding-forum/ ... d-tag.html
http://www.w3.org/
http://www.alistapart.com/articles/flashsatay/
http://www.html4.com/mime/markup/php/ac ... ates_3.php

Re: Addindg a Flash object.

Posted: Mon Dec 31, 2012 4:18 pm
by rudilim
In your <body>, where you want the flash object to appear, insert this code:
(ignore class="bird", that is my own CSS class)

Code: Select all

<div class="bird" id="swf_file"></div>
       
       <script type="text/javascript">

$(document).ready(
function() {
$('#swf_file').flash(
		{'src':'catalog/view/theme/mytheme/image/birdie.swf' ,
		'height':'150' ,
		'width':'150'
		}
		);
}
);
</script>
And in the <header>, insert this:

Code: Select all

<script type="text/javascript" src="catalog/view/javascript/jquery/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="catalog/view/javascript/jquery/jquery.flash.js"></script>
You will need to download the jquery.flash.js and jquery-1.7.1.min.js files and put them in the right folder for it to work.