PDA

Click to See Complete Forum and Search --> : Javascript to unload or stop Flash?



dualflex
12-13-2006, 08:17 PM
Hi all,

I am curently assembling some Macromedia Captivate Flash movie on one web page for my students.

When my user clicks on one of my links, a javascript function makes my DIV content visible simulating a modal window. After, when my user clicks on my X icon I then hide the DIV (visibility:hidden).

All works well but my embedded Flash continues playing! (well I hear the sound cause the DIV is now hidden...)

How can I flush-unload-stop the player elegantly from a javascript function? I must not run into memory issues cause my students can peek at many videos within a session.

Thanks for reading!

marshallhansen
12-13-2006, 08:28 PM
I did this exact thing about a year ago and for the life of me I can't remember off the top of my head. I will look around and try and remember what site it was for then try and find the files. If you haven't got a response by then I will post. I may not get back till tomorrow, but I will.

marshallhansen
12-13-2006, 08:32 PM
I just remebered...You have to put your closing "X" in the flash. Then you can stop the movie/sounds whatever and call your javascript function to hide the div.

dualflex
12-14-2006, 12:59 AM
With Macromedia Captivate all is automatic. It assembles the HTML embedding the SWF file.

Actually I am displaying this HTML file through an Iframe within a DIV for wich I change the VISIBILITY attribute.

I am producing a lot of short movies and don't want to go into the SWF (yes I have a decompiler!). So in this context I really need to control the movie from the browser's JAVASCRIPT.

Any Javascript API for Flash out there?

yasunobu13
12-14-2006, 02:36 AM
If I understand you correctly, your HTML is Div -> IFrame -> Flash

A hack could be to change the location of the iframe to a blank page while the div is hidden. This may not be acceptable for you as the flash movie will be restarted every time the div is unhidden.

dualflex
12-14-2006, 02:33 PM
Found a work around!

When my user clicks on a link, it bumps the current movie by a new one. So I simply built a web page embedding a one frame movie with the Stop_All_Sound(); built in actionscript function!

Here is some code:


function loadContent(URL, idName, my_width, my_height) {
var objetDom = document.getElementById(idName);

document.getElementById("main").style.visibility = "visible";
objetDom.src = URL;
objetDom.width=my_width;
objetDom.height=my_height;
}


function close(idName) {

loadContent("http://abc.abc.com/stopAllSounds.html","my_DIV",500,500);
document.getElementById(idName).style.visibility = "hidden";
}
=================
Salut et la prochaine!

steffycodes
02-21-2008, 10:28 PM
I have been searching around the web and finally I found the right one.... Please can you share the script with me....