Google Groups Home
Help | Sign in
Strange Error using SWFObject with MooTools library
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Mark  
View profile
 More options May 16, 9:40 am
From: Mark <storm.m...@googlemail.com>
Date: Fri, 16 May 2008 06:40:29 -0700 (PDT)
Local: Fri, May 16 2008 9:40 am
Subject: Strange Error using SWFObject with MooTools library
Hi,

I'm using MooTools (www.mootools.net) javascript library for a drop
down navigation in my website. I also use SWFObject to insert Flash
elements throughout my page.

This, so far, works fine.

But the moment I click on a link in the navigation (which directs to a
new page), I get an error message appear before the page url changes.

I don't understand why this happens but I can't put the site live
until I resolve the issue?

The error is "Object doesn't support this method or property"?
Obviously Firefox and Safari don't have any problem with the page.

Any help would be appreciated!

Kind regards,
Mark

My code is as follows (I've removed irrelevant code)....

<script src="/Assets/Scripts/domready.js" type="text/javascript"></
script>
<script src="/Assets/Scripts/contact.js" type="text/javascript"></
script>
<script src="/Assets/Scripts/latest.js" type="text/javascript"></
script>
<script src="/Assets/Scripts/mootools.js" type="text/javascript"></
script>
<script src="/Assets/Scripts/swfobject.js" type="text/javascript"></
script>
<script src="/Assets/Scripts/swfobject-settings.js" type="text/
javascript"></script>
<script type="text/javascript">
window.addEvent('domready', function()
{
        // Create each slide object
        var whatWeDo = new Fx.Slide('ddWhat');
        var whoWeDoItFor = new Fx.Slide('ddWho');
        var archive = new Fx.Slide('ddArchive');

        // Hide the drop down menus
        whatWeDo.hide();
        whoWeDoItFor.hide();
        archive.hide();

        // Add extra spacing to drop down lists
        $('ddWhat').style.paddingBottom = "3px";
        $('ddWho').style.paddingBottom = "3px";
        $('ddArchive').style.paddingBottom = "3px";

        // Add a cursor styles to the drop down headers
        $('toggleWhat').style.cursor = "pointer";
        $('toggleWho').style.cursor = "pointer";
        $('toggleArchive').style.cursor = "pointer";

        // Add a mouse over/out styles to the drop down headers
        $('toggleWhat').onmouseover = function(){ this.style.color =
"#E31F26"; };
        $('toggleWhat').onmouseout = function(){ this.style.color =
"#4c655b"; };
        $('toggleWho').onmouseover = function(){ this.style.color =
"#E31F26"; };
        $('toggleWho').onmouseout = function(){ this.style.color =
"#4c655b"; };
        $('toggleArchive').onmouseover = function(){ this.style.color =
"#E31F26"; };
        $('toggleArchive').onmouseout = function(){ this.style.color =
"#4c655b"; };

        // Add event listeners
        $('toggleWhat').addEvent('click', function(e){ e = new Event(e);
whatWeDo.toggle(); e.stop(); });
        $('toggleWho').addEvent('click', function(e){ e = new Event(e);
whoWeDoItFor.toggle(); e.stop(); });
        $('toggleArchive').addEvent('click', function(e){ e = new Event(e);
archive.toggle(); e.stop(); });

});

</script>
<link rel="stylesheet" type="text/css" href="/Assets/Styles/
Import.css" media="screen">
<!--[if IE 6]>
        <link rel="stylesheet" type="text/css" href="/Assets/Styles/IE6.css"
media="screen">
<![endif]-->

<!--[if IE 7]>
        <link rel="stylesheet" type="text/css" href="/Assets/Styles/IE7.css"
media="screen">
<![endif]-->
<title>storm</title>
</head>
<body>

        <ul id="menu">
                <li><span id="homeButton"><a href="/index.html"><img src="/Assets/
Images/Title-Home.gif" alt="home" /></a></span></li>
                <li><span><img src="/Assets/Images/Title-LookAround.gif" alt="look
around" /></span></li>
                <li><span><a id="toggleWhat" name="toggle">what we do /</a></span>
                        <ul id="ddWhat">
                                <li><a href="/WhatWeDo/marketing-comms.html">marketing comms</a></
li>
                                <li><a href="/WhatWeDo/creative-design.html">creative design</a></
li>
                                <li><a href="/WhatWeDo/digital-media.html">digital media</a></li>
                                <li><a href="/WhatWeDo/publishing.html">publishing</a></li>
                        </ul>
                </li>
                <li class="wwdif"><span><a id="toggleWho" name="toggle">who we do it
for /</a></span>
                        <ul id="ddWho">
                                <li><a href="/WhoWeDoItFor/public-sector.html">public sector</a></
li>
                                <li><a href="/WhoWeDoItFor/private-sector.html">private sector</
a></li>
                        </ul>
                </li>
                <li class="hww"><span><a href="/HowWeWork/index.html">how we work /</
a></span></li>
                <li class="thelatest"><span><a href="/OurWork/index.html">the
latest /</a></span>
                        <ul class="archive">
                                <li><span><a id="toggleArchive" name="toggle">project archive</a></
span>
                                        <ul id="ddArchive">
                                                <li><span>public sector - c2g/c2b</span>
                                                        <ul>
                                                                <li><a href="/Archive/Public/schools-colleges.html">schools /
colleges</a></li>
                                                                <li><a href="/Archive/Public/LSC-partnerships.html">LSC
partnerships</a></li>
                                                                <li><a href="/Archive/Public/arts-council.html">arts council</
a></li>
                                                                <li><a href="/Archive/Public/family-information.html">family
information</a></li>
                                                                <li><a href="/Archive/Public/leisure-and-tourism.html">leisure
and tourism</a></li>
                                                                <li><a href="/Archive/Public/corporate-plans.html">corporate
plans</a></li>
                                                                <li><a href="/Archive/Public/council-business-
forum.html">council business forum</a></li>
                                                                <li><a href="/Archive/Public/connexions.html">connexions</a></
li>
                                                                <li><a href="/Archive/Public/internal-comms.html">internal
comms</a></li>
                                                                <li><a href="/Archive/Public/identity-
branding.html">identity / branding</a></li>
                                                                <li><a href="/Archive/Public/internet-digital-
media.html">internet / digital media</a></li>
                                                                <li><a href="/Archive/Public/video-production.html">video
production</a></li>
                                                                <li><a href="/Archive/Public/civic-publications.html">civic
publications</a></li>
                                                                <li><a href="/Archive/Public/conceptual.html">conceptual</a></
li>
                                                        </ul>
                                                </li>
                                                <li><span>private sector - b2b/b2c</span>
                                                        <ul>
                                                                <li><a href="/Archive/Private/identity-
branding.html">identity / branding</a></li>
                                                                <li><a href="/Archive/Private/creative-design.html">creative
design</a></li>
                                                                <li><a href="/Archive/Private/internet-digital-
media.html">internet / digital media</a></li>
                                                                <li><a href="/Archive/Private/publishing.html">publishing</a></
li>
                                                                <li><a href="/Archive/Private/marketing-comms.html">marketing
comms</a></li>
                                                        </ul>
                                                </li>
                                        </ul>
                                </li>
                        </ul>
                </li>
                <li class="wwu"><span><a href="/WorkWithUs/index.html">work with us/
</a></span></li>
        </ul>

</body>
</html>


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark  
View profile
 More options May 16, 10:05 am
From: Mark <storm.m...@googlemail.com>
Date: Fri, 16 May 2008 07:05:33 -0700 (PDT)
Local: Fri, May 16 2008 10:05 am
Subject: Re: Strange Error using SWFObject with MooTools library
The problem lies in the script file "<script src="/Assets/Scripts/
swfobject-settings.js" type="text/javascript"></script>" because
whenever I remove this script and click on a link then the page
changes fine without triggering an error?

var flashvars = {};

var latestflashvars = {};
latestflashvars.date = "31/02/09";

var paramsHeader = {};
paramsHeader.menu = "false";
paramsHeader.wmode = "transparent";

var params = {};
params.menu = "false";
params.wmode = "opaque";
params.allowFullScreen = "true";

var attributes1 = {};
attributes1.id = "flash";

var attributes2 = {};
attributes2.id = "menu";

var attributes3 = {};
attributes3.id = "welcome";

var attributes4 = {};
attributes4.id = "latest";

var attributes5 = {};
attributes5.id = "flashlatest1";

var attributes6 = {};
attributes6.id = "flashlatest2";

var attributes7 = {};
attributes7.id = "flashlatest3";

var attributes8 = {};
attributes8.id = "latesthome";

var attributes9 = {};
attributes9.id = "sub-header";

// Check if elements are available to replace
addDOMLoadEvent(insertFlash);
function insertFlash()
{
        if(document.getElementById("flash") != null)
    {
        swfobject.embedSWF("/Assets/Flash/Header.swf", "flash", "750",
"295", "9.0.0", "/Assets/Flash/expressInstall.swf", flashvars,
paramsHeader, attributes1);
    }

    if(document.getElementById("menu") != null)
    {
        //swfobject.embedSWF("/Assets/Flash/Menu.swf", "menu", "140",
"848", "9.0.0", "/Assets/Flash/expressInstall.swf", flashvars, params,
attributes2);
    }

    if(document.getElementById("welcome") != null)
    {
        swfobject.embedSWF("/Assets/Flash/Welcome.swf", "welcome",
"565", "195", "9.0.0", "/Assets/Flash/expressInstall.swf", flashvars,
params, attributes3);
    }

    if(document.getElementById("latesthome") != null)
    {
        swfobject.embedSWF("/Assets/Flash/LatestHome.swf",
"latesthome", "565", "24", "9.0.0", "/Assets/Flash/
expressInstall.swf", latestflashvars, params, attributes8);
    }

    if(document.getElementById("latest") != null)
    {
        swfobject.embedSWF("/Assets/Flash/Latest.swf", "latest",
"565", "24", "9.0.0", "/Assets/Flash/expressInstall.swf", flashvars,
params, attributes4);
    }

        if(document.getElementById("sub-header") != null)
    {
        switch(document.getElementById("sub-
header").getAttribute("title"))
                {
                        case "workwithus":
                                swfobject.embedSWF("/Assets/Flash/WorkWithUs.swf", "sub-header",
"560", "189", "9.0.0", "/Assets/Flash/expressInstall.swf", flashvars,
params, attributes9);
                                break;

                        case "howwework":
                                swfobject.embedSWF("/Assets/Flash/HowWeWork.swf", "sub-header",
"560", "189", "9.0.0", "/Assets/Flash/expressInstall.swf", flashvars,
params, attributes9);
                                break;

                        case "privatesector":
                                swfobject.embedSWF("/Assets/Flash/PrivateSector.swf", "sub-
header", "560", "189", "9.0.0", "/Assets/Flash/expressInstall.swf",
flashvars, params, attributes9);
                                break;

                        case "publicsector":
                                swfobject.embedSWF("/Assets/Flash/PublicSector.swf", "sub-header",
"560", "189", "9.0.0", "/Assets/Flash/expressInstall.swf", flashvars,
params, attributes9);
                                break;

                        case "publishing":
                                swfobject.embedSWF("/Assets/Flash/Publishing.swf", "sub-header",
"560", "189", "9.0.0", "/Assets/Flash/expressInstall.swf", flashvars,
params, attributes9);
                                break;

                        case "digitalmedia":
                                swfobject.embedSWF("/Assets/Flash/DigitalMedia.swf", "sub-header",
"560", "189", "9.0.0", "/Assets/Flash/expressInstall.swf", flashvars,
params, attributes9);
                                break;

                        case "creativedesign":
                                swfobject.embedSWF("/Assets/Flash/CreativeDesign.swf", "sub-
header", "560", "189", "9.0.0", "/Assets/Flash/expressInstall.swf",
flashvars, params, attributes9);
                                break;

                        case "marketingcomms":
                                swfobject.embedSWF("/Assets/Flash/MarketingComms.swf", "sub-
header", "560", "189", "9.0.0", "/Assets/Flash/expressInstall.swf",
flashvars, params, attributes9);
                                break;
                }
    }


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
TeckniX  
View profile
 More options May 16, 11:33 am
From: TeckniX <Loki...@gmail.com>
Date: Fri, 16 May 2008 08:33:57 -0700 (PDT)
Local: Fri, May 16 2008 11:33 am
Subject: Re: Strange Error using SWFObject with MooTools library
Although this may seems stupid - I've always been able to solve this
issue by making any JS calls at the end of the page when all elements
have been loaded.

I would check to make sure that the order in which your elements are
loaded doesn't allow one to be loaded after the actual call.
If you'd be kind enough to load it all on a temp area, perhaps i can
have a look at it, although I'm far from a Javascript guru, I've made
a couple of mistakes that allowed me to find some good solutions.

On May 16, 10:05 am, Mark <storm.m...@googlemail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bobby  
View profile
 More options May 16, 4:52 pm
From: Bobby <bobbyvandersl...@gmail.com>
Date: Fri, 16 May 2008 13:52:29 -0700 (PDT)
Local: Fri, May 16 2008 4:52 pm
Subject: Re: Strange Error using SWFObject with MooTools library
embedSWF fires on a SWFObject internal DomContentLoaded event. When
you use an other script that calls these functions on the same event
you can figure that this will probably never be fired. So if you get
rid of constructs like:

addDOMLoadEvent(insertFlash);
function insertFlash()
{
        if(document.getElementById("flash") != null)

and plainly call embedSWF() all should work fine.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark  
View profile
 More options May 19, 4:00 am
From: Mark <storm.m...@googlemail.com>
Date: Mon, 19 May 2008 01:00:08 -0700 (PDT)
Local: Mon, May 19 2008 4:00 am
Subject: Re: Strange Error using SWFObject with MooTools library
Hi,

Thanks for the information, but I need to use the if statements...

e.g.
if(document.getElementById("the-element-to-be-replaced") != null)

...to check if the element I'm looking to replace is available or not
and to use the if statement requires me to use a onDomLoaded style
event otherwise the script runs before the relevant html element is
available in the dom to check against.

I commented out all my code and tested using just the
swfobject.embedSWF() for an element I know exists on all pages (just
to see if this odd error disappeared) but the error still came up the
moment I clicked a link to move to another page in my website?

M.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark  
View profile
 More options May 19, 1:03 pm
From: Mark <storm.m...@googlemail.com>
Date: Mon, 19 May 2008 10:03:57 -0700 (PDT)
Local: Mon, May 19 2008 1:03 pm
Subject: Re: Strange Error using SWFObject with MooTools library
Here is a link to the online version, you can see (if your internet
explorer is setup to show all errors) the problem when you use the
side navigation to click around other pages....

http://www.storm-media.co.uk/storm-media.co.uk/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
philip  
View profile
 More options May 20, 12:54 pm
From: philip <platelu...@gmail.com>
Date: Tue, 20 May 2008 09:54:05 -0700 (PDT)
Local: Tues, May 20 2008 12:54 pm
Subject: Re: Strange Error using SWFObject with MooTools library
if you need to use your own domready script, you can use
swfobject.createSWF(attObj, parObj, replaceElemIdStr) to embed the SWF
without using SWFObject's addDomLoadEvent function.

examples are here: http://code.google.com/p/swfobject/wiki/api

From what I see of your code, you have three different domready-style
scripts in your page:

mootools: window.addEvent("domready", function);
swfobject: swfobject.addDomLoadEvent(fn)
and your own addDOMLoadEvent(insertFlash);

this is redundant and could lead to errors.  if you're sticking with
mootools, get rid of the addDOMLoadEvent(insertFlash) function and
just use window.addEvent("domready", insertFlash);

the mootools documentation is here: http://docs.mootools.net/Window/Window-DomReady.js

On May 19, 10:03 am, Mark <storm.m...@googlemail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google