Skip to main content
Participant
June 27, 2008
Question

Embedding swf files in html

  • June 27, 2008
  • 4 replies
  • 812 views
This may sound like a rather idiotic topic, but I have some problems with getting swf files created by using the free compiler to compile actionscript files into swf files. I do not expect anyone to give me a full explantion of this. I have tried searching the web, but get swamped with results without finding what I am looking for. I am wondering if there are some special issues associated with using this kind of swf files on the internet? I am also wondering if someone know a site that has some good information on various issues that may arise when integrating an swf file into a html page?
This topic has been closed for replies.

4 replies

stevilnAuthor
Participant
June 30, 2008
Thank you for taking the time to look at it. I trusted the FlashObject code, something I should not have done. It seems it works now, on every browser except some versions of Firefox 2, but I do not understand how. I simply added a random variable, removed the flashObj variables and put them in the url to the swf file instead. It sometimes fails in Firefox, maybe one time out of ten, but always works in Explorer. May i be that FlashObject is outdated, and I should use a new version of SWFobject instead?
stevilnAuthor
Participant
June 27, 2008
Yes, your first assumption is correct, but the problem is that it only work in each browser ONCE. If I attempt to reload the page or access another page where the same flash movie is displayed, it does not load, UNLESS I empty the temporary internett folders. In case I delete the internett folders, they work once more, and stops working after the first load.

Yes, I know it is a unique id. The reason is that we use the exact same code for other swf files we have downloaded of the net. The id is 'flashcontent2'.

My embed code is the following. I have tried implementing the alterations Dreamweaver suggested, without any luck:

"<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="" http://macromedia.com/cabs/swflash.cab#version=9,0,0,0""
WIDTH="1004" HEIGHT="159" id="Ergoflash" ALIGN="CENTER">
<PARAM NAME=movie VALUE="Ergoflash.swf?enverdi=en1.jpg;en2.jpg;en3.jpg&toverdi=to2.jpg;to3.jpg;to1.jpg">

<PARAM NAME=quality VALUE=high>
<PARAM NAME=bgcolor VALUE=#FFFFFF>
<embed src="adminmappe/Flashvisning/input/Ergoflash.swf?enverdi=uploads/flash_liten1.jpg;uploads/flash_liten2.jpg&toverdi=uploads/to2.jpg;uploads/to3.jpg;uploads/to1.jpg"
quality="high" bgcolor="#FFFFFF" WIDTH="1004" HEIGHT="159"
NAME="Ergoflash" ALIGN TYPE="application/x-shockwave-flash"
PLUGINSPAGE=" http://www.macromedia.com/go/getflashplayer">
</OBJECT>"

I have tried not having any arguments and loading the images from preset paths inside de swf, without any luck. The javascript code is as follows:

"<div id="flashcontent2"/>
<script type="text/javascript" src="FlashObject.js"></script>
<script>
<!--
var flashObj = new FlashObject ("Ergoflash.swf", "SlideShow", "1004", "159", 8, "#FFFFFF", true);
flashObj.addVariable ("enverdi",'flash_liten1.jpg;flash_liten2.jpg');
flashObj.addVariable ("toverdi", 'flash_stor1.jpg;flash_stor2.jpg;flash_stor3.jpg;flash_stor4.jpg');

<?php /*flashObj.addVariable ("xmlUrl", "images.xml");*/ ?>
flashObj.write ("flashcontent2");
// -->
</script>
</div>"


Maybe the FlashObject is a to old version, but it works with other sef files?
Inspiring
June 27, 2008
I don't know if all I noticed are deal breakers but I see several issues in your code:

1. The div has closure as if it was an empty XML node: <div id="flashcontent2"/> and </div> at the end. This is not a correct syntax and most definitely it confuses browser.

I suggest you try <div id="flashcontent2"> without slash.

2. I am not sure if this is such a good idea to have slashes in the flash variables. I refer to the string uploads/flash_liten1.jpg;uploads/flash_liten2.jpg&toverdi=uploads/to2.jpg;uploads/to3.jpg;uploads/to1.jpg. This string must be url encoded to escape special characters.

3. the value of enverdi= is different in object and embed tags.

4. address of your movie: in object it is adminmappe/Flashvisning/input/Ergoflash.swf?, in embed it is just Ergoflash.swf? - they are different

5. If you think you have browser cache issues - you need to at least add random url/flashvars variable that will trick the browser into thinking that it deals with a new entity. so that browser reloads the movie every time.

Hope it helps.
stevilnAuthor
Participant
June 27, 2008
I have been able to test it some more. When I use the standard embed tags in Firefox and Opera, it works perfectly, but does not appear in Internet Explorer 7 at all. The object tags does not seem to work. When I use FlashObject to load the swf, the flash move appears and works perfectly in both Firefox and explorer, the FIRST time. When I attempt to load it the second time and so on it does not appear at all in both Explorer and Firefox. The exception is my home PC where it works perfectly in Explorer 7. So it really is a total mess. May I have used some code that Explorer does not like?
Inspiring
June 27, 2008
So, are you saying that when you use JavaScript to embed the movie - it works in both browsers and when you use embed/object tags - it doesn't work in IE. Correct?

Second question, when you embed it with JS - what is the id of the DOM element you are embedding it into? Is it a unique id?

For the best result I think you should post your embed code.
Inspiring
June 27, 2008
Could please describe exactly what is the problem? Does swf appear on the page or you see a performance issues? Or is it something else?