Hide flash swf when peoplefinder shelf is opened

Information and discussion on Javascript.

Moderators: rcrisler1, saltybeagle

Hide flash swf when peoplefinder shelf is opened

Postby Joel Brehm » Fri Sep 22, 2006 8:43 am

Is there an code available to hide my flash movie when the peoplefinder shelf is opened? Something like the javascript that hides the sIFR title, only it works for a specific swf file.

Thanks
Joel Brehm
 
Posts: 15
Joined: Mon Jan 30, 2006 12:10 pm
Location: Office of Research: 104 Alex

Postby Joel Brehm » Thu Sep 28, 2006 10:32 am

bueller? bueller?

How about something like this, the current javascript gets edited to include a couple lines, and if we have flash object that needs to be hidden, it gets put in a div tag with the ID = hideflash

/*drop down animation*/
function setupFunc(element, effect){
if (!sIFR.UA.bIsIE) {
var sifr1 = document.getElementById('titlegraphic').getElementsByTagName('h1');
var sifr2 = document.getElementById('titlegraphic').getElementsByTagName('h2');
sifr1[0].style.display='none';
sifr2[0].style.display='none';
}
var bc = document.getElementById('breadcrumbs');
for(var i=0; i < bc.getElementsByTagName("ul").length; i++){
bc.getElementsByTagName("ul")[i].style.display='none';
}

var hide_flash = document.getElementById('hideflash');
hide_flash.style.display='none';


Spry.Effect.AppearFade('sitetools', {duration: 2500, from: 0, to: 100, toggle: false});}

function finishFunc(element, effect){}

/* pull up animation */
function setupFuncOff(element, effect){
Spry.Effect.AppearFade('sitetools', {duration: 500, from: 100, to: 0, toggle: false});
if (!sIFR.UA.bIsIE) {
var sifr1 = document.getElementById('titlegraphic').getElementsByTagName('h1');
var sifr2 = document.getElementById('titlegraphic').getElementsByTagName('h2');
sifr1[0].style.display='block';
sifr2[0].style.display='block';
}

var hide_flash = document.getElementById('hideflash');
hide_flash.style.display='block';

}

function finishFuncOff(element, effect){var tab = document.getElementById('sitetools');tab.style.display='none';
var bc = document.getElementById('breadcrumbs');
for(var i=0; i < bc.getElementsByTagName("ul").length; i++){
bc.getElementsByTagName("ul")[i].style.display='inline';
}
}

It's hard to test, so I don't know if the code is accurate. Does anybody have any comments?
Joel Brehm
 
Posts: 15
Joined: Mon Jan 30, 2006 12:10 pm
Location: Office of Research: 104 Alex

Me Too

Postby cwells » Wed Oct 04, 2006 2:23 pm

Our website has a flash file that is misbehaving as well. Any word on whether the suggested change has been made?

Thanks,
Carol Wells
cwells
 
Posts: 7
Joined: Wed Jun 21, 2006 3:49 pm
Location: East Campus

Postby saltybeagle » Thu Oct 05, 2006 10:20 am

Ok...

Joel, what you're suggesting is great. There's a bit of a problem with dropping in what you're suggesting. For 1, if there is no element with an id of 'hideflash' the javascript will fail and cause an error. This also wouldn't work if you have multiple elements you want to hide.


To solve this, I would prefer a callback method which the users would define. The callback can be a simple function with a name like 'openShelfCallback' or 'closeShelfCallback' which by default would do nothing. In your code, you would define the openShelfCallback, and closeShelfCallback functions which would override the default. Inside your own openShelfCallback you would place everything you wanted to trigger on shelf open and close.

I hope that makes sense.... if anyone else has a better idea, I'm all ears.

I can try and get this into the javascript source if someone is willing to write up some WDN wiki documentation on how to use it.
Brett Bieber
Image
saltybeagle
 
Posts: 376
Joined: Fri Jan 16, 2004 3:10 pm
Location: 321 Admin

Postby Joel Brehm » Thu Oct 05, 2006 11:38 am

I like the idea of writing our own function. Brett, If you can put the code in the main js file, I can test out the function and write up some wiki documentation once it's working.

Joel
Joel Brehm
 
Posts: 15
Joined: Mon Jan 30, 2006 12:10 pm
Location: Office of Research: 104 Alex

Postby saltybeagle » Thu Oct 12, 2006 9:09 am

A callback function has been added to the templates, and released this AM.


See an example at http://ucommbieber.unl.edu/workspace/UNLTemplates/
Brett Bieber
Image
saltybeagle
 
Posts: 376
Joined: Fri Jan 16, 2004 3:10 pm
Location: 321 Admin

Postby Joel Brehm » Wed Nov 15, 2006 2:53 pm

The hide function does what it's supposed to, and works great. But there is something called SWFObject: http://blog.deconcept.com/swfobject/

This javascript allows you to insert your flash file so it conforms to w3c standards, doesn't have that stupid "click to activate" in ie, and hides behind the shelf when it's opened.

This is how I inserted my flash file:

<script></script>

<div>
Javascript is not enabled for your browser.
</div>

<script>
var so = new SWFObject("mainflash2006.swf", "myflash", "700", "242", "7", "#ffffff");
so.addParam("wmode", "transparent");
so.write("flashcontent");

</script>
Joel Brehm
 
Posts: 15
Joined: Mon Jan 30, 2006 12:10 pm
Location: Office of Research: 104 Alex


Return to Javascript

Who is online

Users browsing this forum: No registered users and 0 guests

cron