TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 219
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 130
  • Total: 131
  • lurkalot

Embedding Flash (The correct way)

Started by akulion, October 04, 2006, 04:04:04 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

akulion

Hi,

I have noticed that a LOT of people are still using the old <object embed code for putting flash on their pages.

The above mentioned method is outdated and will not work with all browsers anymore.
As usual everything was working fine until our great Mr. Bill gates decided to change things in his browser and so it became so that using the object embed command made the flash movie 'inactive' and requires user intervention to activate the movie (by clicking it once)

To embed flash movies in your pages the proper way please use the following format from now on as it is compatible with all browsers as well as it is more secure (security wise)

Step 1: Download this file - Unzip and upload the content to the same folder as your flash files! [Very Important!]

step 2: Use the code below to embed flash movies into your pages:



<script type="text/javascript" src="flashobject.js"></script>

<div id="flashcontent" style="width: 650px; height: 150px"></div>

<script type="text/javascript">
var fo = new FlashObject("YOUR MOVIE FULL PATH", "animationName", "650", "150", "8", "#FFFFFF");
fo.addParam("allowScriptAccess", "sameDomain");
fo.addParam("quality", "high");
fo.addParam("scale", "noscale");
fo.addParam("loop", "false");
fo.write("flashcontent");
</script>



In the above it should be understood that:

<div id="flashcontent" style="width: 650px; height: 150px"> Defines the height and width of the container of your movie and must be the same as your movie height and width.

("YOUR MOVIE FULL PATH", "animationName", "650", "150", "8", "#FFFFFF") Defines your movie URL, width, height and background color. Make sure the height/width is the same as in the DIV tags.

Also if you are putting more than 1 flash movie on a single page then it is very important that you make sure these are different for both movies:
id="flashcontent"
fo.write("flashcontent");

So for example if you have 3 movies there u will name them : flashcontent1, 2 and 3 respectively. But make sure that in a single movie code the 2 instances of flashcontent match (have the same number)

Thats all - and also remember always keep your flash player updated and try and avoid internet explorer since despite their 'security updates' recently over 1000 people got hacked via IE because of a loophole in their flash handling.

Aku

Crip

Does this mean .swf/flash Clocks too? ;D
I have become comfortably numb!

Cripzone | Crip's Free 2.0.2 Themes



akulion


knat

Your links is dead Aku  ::)

Anyway i use this method.. its almost the same

html code
<script type="text/javascript" src="swfobject.js"></script>
<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="expressinstall.html?detectflash=false">bypass the detection</a> if you wish.
</div>

<script type="text/javascript">
// <![CDATA[

var so = new SWFObject("urltoyourflash.swf", "titleofyourflash", "300", "300", "8.0.23", "#FF6600", true);
so.addVariable("flashVarText", "this is passed in via FlashVars"); // this line is optional, but this example uses the variable and displays this text inside the flash movie
so.write("flashcontent");

// ]]>
</script>


You have to have the attached javascript file in the same dir as your flash file. (i have both in my root and it works)

;)

yjobcreations


akulion

Flash banners have internal variables which handle the links, u have to add the link inside the flash itself




penfield

#6
can the code to embed the movies be used in index.template.php file? I'd like to use an .swf movie as a header. if not, does anyone know php code that would do the trick? Thanks!

penfield

I uploaded the flashobject script to the same folder as my flashobject and index.template.php, where I put the html to embed the flash. i get this errorFlashObject is not defined
[Break on this error] var fo = new FlashObject("http://www.blah.com/folder/Themes/scrib/p...

The html code i am using is:<html>

<script type="text/javascript" src="flashobject.js"></script>

<div id="flashcontent" style="width: 468px; height: 60px"></div>

<script type="text/javascript">
var fo = new FlashObject("http://www.blah.com/Themes/scrib/pab.swf", "pab", "468", "60", "8", "#FFFFFF");
fo.addParam("allowScriptAccess", "sameDomain");
fo.addParam("quality", "high");
fo.addParam("scale", "noscale");
fo.addParam("loop", "false");
fo.write("flashcontent");
</script>




</html>
Any advice would be most appreciated :) Thanks!

stormlrd

bro would you mind adding this to the tut section of the site im working on? I think its an important tip for flash and themeing

akulion

try using the full address for the file like

......src="http://yoursite.com/whatever/flashobject.js"

that way it would know the exact address.
normally I also use the full addresses for the flash files but u dont have to

if u dont wana use full address, then put the flash objects file in ur forum root folder (where u have Avatars, Smileys, Themes, etc)

storm feel free to use - in fact there is a code generator on this page:
http://www.kirupa.com/developer/flash8/flash_fix.htm

I will see if they allow its usage or not, it would be cool if they did, then u could put it on the page

This website is proudly hosted on Crocweb Cloud Website Hosting.