...

View Full Version : Embedding Problem SWFObject



CG2011
04-08-2011, 03:03 PM
I'm getting Error: Object doesn't support property or method 'addEvent' in my webpage.

I'm trying to embed a flash carousel in an asp.net page and I have this, but nothing is showing on my page. Using IE9 and FF4


<script type="text/javascript">
window.addEvent('load', function() {
var flashvars = {
xmlLocation: "<%=ResolveUrl("upload/data.xml")%>",
imageLocation: "<%=ResolveUrl("~/upload/")%>"
};
swfobject.embedSWF("<%=ResolveUrl("~/upload/Carousel-Test.swf")%>", "FlashContainer", "576", "242", "10.0.32", "", flashvars, null, null);
});
</script>

The xml has some settings for the images and all my images are in the upload folder in my project. I have reference to the swfobject js in the masterpage (head) and the homepage inherits from it:
<script src="javascript/swfobject.js" type="text/javascript"></script>.

Anyone give some suggestions? :thumbsup:

_Aerospace_Eng_
04-08-2011, 05:58 PM
Why are you trying to add an event? Just remove the add event stuff. No need for our unless you really need to have it load after everything else loads.

CG2011
04-08-2011, 06:58 PM
thanks for getting back.

i thought that error was the reason why my flash was not displaying. while it;s got rid of the error my flash is still not shown on page.

any suggestions?

_Aerospace_Eng_
04-08-2011, 08:15 PM
Do you have a div with id="FlashContainer" in your html? The argument after the flash version should be false. That is for the express install option. What version of flash player do you have?

CG2011
04-08-2011, 10:51 PM
hey,

i do have div with id=FlashContainer. i;ve now set the value to false and i checked the flash version which was incorrect, so now i've corrected that. still, it won't show up. i've made some changes in case it was not finding directory properly. flash file is now at root level while my images/xml file which is still in upload folder.


<script src="javascript/swfobject.js" type="text/javascript"></script>
<script type="text/javascript">
function () {
var flashvars = {
xmlLocation: ("upload/data.xml"),
imageLocation: ("upload")
};
swfobject.embedSWF("Carousel-Test.swf", "FlashContainer", "576", "242", "10.2.153.1", false, flashvars, null, null);
};
</script>

anything else i can try? thanks for the help

_Aerospace_Eng_
04-08-2011, 11:10 PM
You didn't remove everything you were supposed to.
Try this

<script src="javascript/swfobject.js" type="text/javascript"></script>
<script type="text/javascript">
var flashvars = {
xmlLocation: "upload/data.xml",
imageLocation: "upload"
};
swfobject.embedSWF("Carousel-Test.swf", "FlashContainer", "576", "242", "9.0.0.0", false, flashvars, null, null);
</script>
Compare that to what you have. Note that I changed the flash version number. Not everyone will have the latest version due to them not knowing to upgrade or they can't for some reason. I removed the empty "function" you had.

CG2011
04-09-2011, 01:58 PM
many thanks for your help! i used what you wrote and that seemed to work. i have one final thing though. while the flash object is now appearing inisde my div, it supposed to display my images on the flash - which are basically links to other pages. the settigns is on data.xml which is in the upload folder and code is like this:


<?xml version="1.0" encoding="UTF-8"?>
<settings

rotationKind="1"
rotationSpeed="4"
enableMouseWheel="0"
stopRotatingOnMouseOver="1"

autoRotateMode="0"
autoRotateInterval="0"
stopAutoRotateOnClick="1"

useTooltip="0"
tooltipColor1="#5C9BF8"
tooltipColor2="#ffffff"
tooltipColor3="#999999"
showTooltipHelp="0"
tooltipHelpMove="Click to rotate to front"
tooltipHelpLink="Click to follow this link"

useSubtitle="1"
subtitleY = "265"
useSecondCaption="1"

useNavigationButtons="0"
navigationY = "420"

borderColor="#ffce00"
borderThickness="3.5"
useImageSmoothing="1"
playRollOverSound="0"

spanX="175"
spanY="30"
centerX="325"
centerY="225"
distanceValue="0"
distanceDarken="0.5"
perspectiveRatio="0.8"
minimumscale="0.5"

useFocalBlur="1"
focalBlurValue="0.15"
useMotionBlur="1"
motionBlurValue="0.5"
useFadeOnMouseOver="0"
mouseOverDarkness=".2"
useReflection="1"
reflectionAlphaValue="0.5"

/>

<thumbs>

<thumb
type="image"
imageURL="~img1.jpg"
linkData="http://www.t1.html"
linkType="URL"
linkTarget="_blank"
captionText="test img 1"
captionText2="test img 1"
enableButtonWhenInFront="1"
/>

<thumb
type="image"
imageURL="img2.jpg"
linkData="http://www.t1.html"
linkType="URL"
linkTarget="_blank"
captionText="test img2"
captionText2="test img2"
enableButtonWhenInFront="1"
/>
</thumbs>


any suggestion why it might not find my images?

_Aerospace_Eng_
04-09-2011, 07:15 PM
The only thing I can think of is the path to the images are wrong. Am I correct to assume that the images are at upload/blahsomeimage.jpg? Try this for your flashvars

var flashvars = {
xmlLocation: "/upload/data.xml",
imageLocation: "/upload/"
};
If the page that has your flash is at the root of your site then the above should work.

CG2011
04-09-2011, 08:50 PM
bang on!

i missed the slash / after upload!

thanks for all the help! :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum