The CAFE
Design Challenge 9

Last active: Never
Not logged in [Login - Register]
Go To Bottom

Printable Version
Subscribe | Add to Favourites

Post new thread
Author: Subject: Swf object
WhatNow
coffee drinker
**


Avatar


Posts: 60
Registered: 12/9/2008
Member Is Offline


posted on 11/7/2009 at 12:13 PM Reply With Quote
Swf object



Hi everyone. I am trying to get my head around using swf object to embed my flash into my website. I am using the cs3 suite. This is my old code (using Dreamweavers insert flash):

<div id="slideshow">
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','900','height','519','title', 'Image Gallery of Artist Denise Walker ','src','Home/slideshow/slideshow','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=Sh ockwaveFlash','base','.','movie','Home/slideshow/slideshow' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="900" height="519" title="Image Gallery of Artist Denise Walker ">
<param name="movie" value="Home/slideshow/slideshow.swf" />
<param name="quality" value="high" />
<param name="base" value="." />
<embed src="Home/slideshow/slideshow.swf" width="900" height="519" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" base="."></embed>
</object>
</noscript>
</div><!--end of slideshow-->

I have downloaded swf object and have the following files:

expressinstall.swf
index_dynamic.html
index.html
swobject.js
and a source folder with expressinstall.js and expressinstall.fla and swfobject.js

I have been reading up on it but without any java script knowledge, I find it pretty confusing.

Do I put the expressinstall.swf and the swfobject.js in the head of the document, like so

<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.registerObject("slideshow", "9.0.0", "expressInstall.swf");
</script>


// ]]>
</script>


AND would the body be something like this:


<div id="slideshow">
<strong>You need to upgrade your Flash Player</strong>
<script type="text/javascript">
// <![CDATA[

var so = new SWFObject("slideshow/slideshow.swf", "slideshow", "900", "519", "0","" );

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.useExpressInstall('expressinstall.swf');
<param name="movie" value="slideshow.swf" />
<param name="movie" value="Home/slideshow/slideshow.swf" />
<param name="quality" value="high" />
<param name="base" value="." />


so.write("slideshow");

// ]]>
</script>

I probably have this all mixed up. I would really appreciate any help, thanks.




http://i605.photobucket.com/albums/tt133/WhatNowThe2nd/Signature.jpg
View User's Profile Visit User's Homepage View All Posts By User U2U Member
mkeefe
PhotoshopCafe Developer
******


Avatar


Posts: 7437
Registered: 2/10/2003
Location: Boston MA, USA
Member Is Offline

Mood: Eager to code, hello Flex!

posted on 11/7/2009 at 04:04 PM Reply With Quote


You have it right actually. The Javascript block just always needs to be below the DIV it will sit inside.

Matt




Dev: PHP, AS3, Flex and AIR
Work / Photography / twitter / Scriptplayground

http://mkeefe.com/s.jpg
View User's Profile E-Mail User Visit User's Homepage View All Posts By User U2U Member mkeefe's Aim
WhatNow
coffee drinker
**


Avatar


Posts: 60
Registered: 12/9/2008
Member Is Offline


posted on 11/7/2009 at 09:24 PM Reply With Quote


Wow I am amazed, thanks for that. Which bit is the javascript block and is it below the div it will sit inside?



http://i605.photobucket.com/albums/tt133/WhatNowThe2nd/Signature.jpg
View User's Profile Visit User's Homepage View All Posts By User U2U Member
mkeefe
PhotoshopCafe Developer
******


Avatar


Posts: 7437
Registered: 2/10/2003
Location: Boston MA, USA
Member Is Offline

Mood: Eager to code, hello Flex!

posted on 11/8/2009 at 07:42 AM Reply With Quote


the second part, and yup.



Dev: PHP, AS3, Flex and AIR
Work / Photography / twitter / Scriptplayground

http://mkeefe.com/s.jpg
View User's Profile E-Mail User Visit User's Homepage View All Posts By User U2U Member mkeefe's Aim
kiwicolin
boss man
******


Avatar


Posts: 8467
Registered: 9/1/2002
Location: OC Southern California
Member Is Offline

Mood: Content

posted on 11/8/2009 at 09:10 AM Reply With Quote


Looks like you got it Matt. Good ol' swfObject, gotta love it :)



http://www.PhotoshopCAFE.com/kiwicolin1.gif
View User's Profile Visit User's Homepage View All Posts By User U2U Member
WhatNow
coffee drinker
**


Avatar


Posts: 60
Registered: 12/9/2008
Member Is Offline


posted on 11/8/2009 at 09:49 AM Reply With Quote


Thanks!



http://i605.photobucket.com/albums/tt133/WhatNowThe2nd/Signature.jpg
View User's Profile Visit User's Homepage View All Posts By User U2U Member
WhatNow
coffee drinker
**


Avatar


Posts: 60
Registered: 12/9/2008
Member Is Offline


posted on 11/8/2009 at 10:56 PM Reply With Quote


I used the above code and my flashplayer disappeared and all that is left is the words "You need to upgrade your flashplayer. Obviously I didnt get it right. Would you mind re-looking at the above code. I may have the path to the swf object wrong. My site structure is KimberleyWebDesign>Links>slideshow>slideshow.swf and I have placed the swfobject and the expressinstall.swf in the Links folder. Should it be in the slideshow folder?


I used the SWFObject 2 HTML and JavaScript generator v1.2 and the code it produced was this: WHICH doesnt work either.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.registerObject("SlideShowPro", "9.0.0", "expressInstall.swf");
</script>
</head>
<body>
<div>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="680" height="500" id="SlideShowPro" name="movie">
<param name="movie" value="slideshow.swf" />
<param name="quality" value="high" />
<param name="allowfullscreen" value="false" />
<param name="base" value=""."" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="slideshow.swf" width="680" height="500">
<param name="quality" value="high" />
<param name="allowfullscreen" value="false" />
<param name="base" value=""."" />
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
</body>
</html>


I would really love to get a grip on this but not understanding the code, is driving me nuts.

Thanks for any help you can offer.




http://i605.photobucket.com/albums/tt133/WhatNowThe2nd/Signature.jpg
View User's Profile Visit User's Homepage View All Posts By User U2U Member
mkeefe
PhotoshopCafe Developer
******


Avatar


Posts: 7437
Registered: 2/10/2003
Location: Boston MA, USA
Member Is Offline

Mood: Eager to code, hello Flex!

posted on 11/8/2009 at 11:03 PM Reply With Quote


Your code is going to look for the swfobject.js file in the same directory your HTML page is, based on what the code says here. Not knowing DW at all its hard for me to say what it expects to see. I hand-code everything at this point and am so out of touch with WYSIWYG editors...

Matt




Dev: PHP, AS3, Flex and AIR
Work / Photography / twitter / Scriptplayground

http://mkeefe.com/s.jpg
View User's Profile E-Mail User Visit User's Homepage View All Posts By User U2U Member mkeefe's Aim
WhatNow
coffee drinker
**


Avatar


Posts: 60
Registered: 12/9/2008
Member Is Offline


posted on 11/8/2009 at 11:08 PM Reply With Quote


Thanks for your quick response. Are you referrring to the code generated by the Java Script Generator or are you referring to the code from the previous posts?



http://i605.photobucket.com/albums/tt133/WhatNowThe2nd/Signature.jpg
View User's Profile Visit User's Homepage View All Posts By User U2U Member
mkeefe
PhotoshopCafe Developer
******


Avatar


Posts: 7437
Registered: 2/10/2003
Location: Boston MA, USA
Member Is Offline

Mood: Eager to code, hello Flex!

posted on 11/8/2009 at 11:13 PM Reply With Quote


Here is code from a site of mine, maybe it will help. The .js file is located in the same directory as the .html file.

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="imagetoolbar" content="no" />
<meta http-equiv="imagetoolbar" content="false" />
<meta name="MSSmartTagsPreventParsing" content="true" />
<link rel="stylesheet" type="text/css" href="main.css" />
<script src="swfobject.js" type="text/javascript"></script>
<title>mkeefeDESIGN &raquo; Video Player</title>

</head>
<body>

<div class="flashContent" id="flashContainer">Flash is required. Please download/install it.</div>
<script type="text/javascript">
// <![CDATA[

var so = new SWFObject("VideoPlayer.swf", "VideoPlayer", "880", "490", "10", "#000000");
so.addParam("allowScriptAccess", "sameDomain");
so.addParam("allowFullScreen", "true");
so.addParam("quality", "high");
so.addParam("scale", "noscale");
so.addParam("allow", "noscale");
so.addParam("loop", "false");

// Video settings
so.addVariable("title", "Sample Video");

so.write("flashContainer");

// ]]>
</script>

</body>
</html>


Matt




Dev: PHP, AS3, Flex and AIR
Work / Photography / twitter / Scriptplayground

http://mkeefe.com/s.jpg
View User's Profile E-Mail User Visit User's Homepage View All Posts By User U2U Member mkeefe's Aim
WhatNow
coffee drinker
**


Avatar


Posts: 60
Registered: 12/9/2008
Member Is Offline


posted on 11/8/2009 at 11:15 PM Reply With Quote


Thanks I will have a play around with that



http://i605.photobucket.com/albums/tt133/WhatNowThe2nd/Signature.jpg
View User's Profile Visit User's Homepage View All Posts By User U2U Member
WhatNow
coffee drinker
**


Avatar


Posts: 60
Registered: 12/9/2008
Member Is Offline


posted on 11/9/2009 at 12:37 AM Reply With Quote


Hi well yours is quite a bit different from mine, so it doesnt really help that much. With regards to this line, the second reference , "VideoPlayer", is this a reference to the instance name of the flash?

var so = new SWFObject("VideoPlayer.swf", "VideoPlayer", "880", "490", "10", "#000000");

With regards to: <div class="flashContent" id="flashContainer">Flash is required. Please download/install it.</div>

the id="flashContainer" is this a reference to the div that the player is wrapped in?

Thanks




http://i605.photobucket.com/albums/tt133/WhatNowThe2nd/Signature.jpg
View User's Profile Visit User's Homepage View All Posts By User U2U Member
Post new thread


Go To Top


Version ( removed for security concerns )

[queries: 17]
[PHP: 86.4% - SQL: 13.6%]


PhotoshopCD