Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Flash and Javascript sets DIV visibilityFlash and Javascript sets DIV visibility
Previous
 
Next
New Post
2/24/2007 3:51 PM
 
Here's a problem that's been plaguing me for weeks. I have a site that has a Flash based menu with hard coded links which are supposed to pass values to a Javascript I have in the skin file, and in turn sets the visibility of DIV elements.

Here is the Flash Actionscript for the Flash file that sits in the skin folder and is used in the skin:
homeb.onRelease = function (){
    getURL(" showLayer(\'contentpane\')");
};
portfoliob.onRelease = function (){
    getURL(" showLayer(\'portfolio\')");
};
contactb.onRelease = function() {
    getURL(" showLayer(\'contactus\')");
};

Here is the Javascript which sits in the ascx skin file:

<script type="text/javascript" language="JavaScript">
var currentLayer = 'contentpane';
function showLayer(lyr) {
   hideLayer(currentLayer);
   document.getElementById(lyr).style.visibility = 'visible';
   currentLayer = lyr;
}

function hideLayer(lyr) {
   document.getElementById(lyr).style.visibility = 'hidden';
}
</script>

And here are the DIVs in the ascx file that are supposed to change:
<div id="contentpane" runat="server" style="visibility: visible;">
</div>
<div id="portfolio" runat="server" style="visibility: hidden;">
</div>
<div id="contactus" runat="server" style="visibility: hidden;">
</div>

It doesn't work and I'm beating my head around trying to figure it out. I tried this in a couple of different ways and it didn't work. What is really getting me is that I did something similar on another site and it worked fine. Here's the code for that project:

function toggleVisibility(id, NNtype, IEtype, WC3type, display) {
    if (document.getElementById) {
        eval("document.getElementById(id).style.visibility = \"" + WC3type + "\"");
        eval("document.getElementById(id).style.display = \"" + display + "\"");
    } else {
        if (document.layers) {
            document.layers[id].visibility = NNtype;
        } else {
            if (document.all) {
                eval("document.all." + id + ".style.visibility = \"" + IEtype + "\"");
                eval("document.all." + id + ".style.display = \"" + display + "\"");
            }
        }
    }
}

<div id="LayerName" style="visibility: hidden; display: none;" onmouseout="toggleVisibility('LayerName','hidden','hidden','hidden','none');" onmouseover="toggleVisibility('LayerName','show','visible','visible','inline');">

I tried using this Javascript instead and changing the actionscript to be the following (which didn't work either):
getURL(" toggleVisibility('portfolio','hidden','hidden','hidden','none'); toggleVisibility('contentpane','hidden','hidden','hidden','none'); toggleVisibility('contactus','show','visible','visible','inline');");

 I can only conclude that the value is getting lost somewhere between Flash and the Javascript as the code worked in my other project (which didn't use Flash). Does anyone know what I'm doing wrong?
 
New Post
2/25/2007 12:42 PM
 

I have had many such issues with combination of JS file sitting in Skin folder and Flash Action script. I found that the path to each is not easy to sort out, Remember that your skin can see the JS file and action it. But the reference you make inside your flash.swf file cannot find the JS file since it does not know where it is . When the SWF file is active is JS  actually in default.aspx and therefore it needs to find the path all the way to your skin folder which is not evident.

One method would be to place the JS file somewhere that you can refer to it via http://yoursite.com/js file.

Salar

 
New Post
2/25/2007 6:52 PM
 
Thanks Salar! I will try putting the SWF and the JS in the root folder and not use <%= skinpath %> to reference the Flash file. There is also a script I found here that will allow you to embed javascript in the head of your page, so I think that will allow me to reference it in the root. I will try it and post the resulting link if it works. FINGERS CROSSED!
 
New Post
2/26/2007 1:18 AM
 
I tried and failed. Are you available to help figure this out? If so please email me at phixate (at) yahoo dot com. I would like to get a quote and get this job finished. Thanks again for your help.
 
New Post
2/26/2007 5:35 AM
 

Sure

This is relevant to our future work too.

Please send your work and we will check it out. I will email you.

Salar

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Flash and Javascript sets DIV visibilityFlash and Javascript sets DIV visibility


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out