I'm building a website for a university project and i've hit a bit of a wall... I have a couple of flash objects (flv player) in hidden divs, which use javascript to pop up. i noticed that once one of the divs is closed, the video/audio from that div will keep playing unless paused/stopped while the div is visible. I've been trying to figure out a way to stop playback of the swf files via a javascript function to no avail. I essentially know nothing about javascript which really doesn't help - I only started learning html & css a few months ago but have picked it up very quickly.
As I said, I have tried a couple of methods so far as advised by friends but they relied on object tags:
Now I am using swfObject to embed the flash objects so as to keep IE compatibility which means i no longer have object tags. i now have a .js file named "swfobject.js", accompanied by:
<script type="text/javascript">
var flashvars = {};
var params = {};
var attributes = {};
attributes.id = "flashcontent";
swfobject.embedSWF("lighthead.swf", "myAlternativeContent", "500", "100", "10", false, flashvars, params, attributes);
</script>
<script type="text/javascript">
var flashvars = {};
var params = {};
var attributes = {};
attributes.id = "flashcontent2";
swfobject.embedSWF("mp3Player.swf", "myAlternativeContent2", "300", "100", "10", false, flashvars, params, attributes);
</script>
<script type="text/javascript">
var flashvars = {};
var params = {};
var attributes = {};
attributes.id = "flashcontent3";
swfobject.embedSWF("video.swf", "myAlternativeContent3", "400", "320", "10", false, flashvars, params, attributes);
</script>
(these examples cover all 3 flash objects on the page, one of which is just a header. the problem I'm having is only relevant to "mp3Player.swf" and "video.swf")
I'm supposed to hand this project in on friday and I have to create and entire research project, portfolio and presentation to go with it, all in one day. Due to this, I will hand it in without solving this problem if necessary but I'm a perfectionist and would really appreciate any help anyone can give me!! Also, I really want to learn more about how js works and solving this problem would be a small breakthrough for me. Please help!!!!
Question
DrKrepz
I'm building a website for a university project and i've hit a bit of a wall... I have a couple of flash objects (flv player) in hidden divs, which use javascript to pop up. i noticed that once one of the divs is closed, the video/audio from that div will keep playing unless paused/stopped while the div is visible. I've been trying to figure out a way to stop playback of the swf files via a javascript function to no avail. I essentially know nothing about javascript which really doesn't help - I only started learning html & css a few months ago but have picked it up very quickly.
As I said, I have tried a couple of methods so far as advised by friends but they relied on object tags:
paired with js:
function StopflvMovie() { var mov=getFlashMovieObject(flvMovie"); mov.Stop(); }<span id="close"><a href="javascript:StopflvMovie();setVisible('layer3')" style="text-decoration: none">Close</a></span>Now I am using swfObject to embed the flash objects so as to keep IE compatibility which means i no longer have object tags. i now have a .js file named "swfobject.js", accompanied by:
<script type="text/javascript"> var flashvars = {}; var params = {}; var attributes = {}; attributes.id = "flashcontent"; swfobject.embedSWF("lighthead.swf", "myAlternativeContent", "500", "100", "10", false, flashvars, params, attributes); </script> <script type="text/javascript"> var flashvars = {}; var params = {}; var attributes = {}; attributes.id = "flashcontent2"; swfobject.embedSWF("mp3Player.swf", "myAlternativeContent2", "300", "100", "10", false, flashvars, params, attributes); </script> <script type="text/javascript"> var flashvars = {}; var params = {}; var attributes = {}; attributes.id = "flashcontent3"; swfobject.embedSWF("video.swf", "myAlternativeContent3", "400", "320", "10", false, flashvars, params, attributes); </script>and:
(these examples cover all 3 flash objects on the page, one of which is just a header. the problem I'm having is only relevant to "mp3Player.swf" and "video.swf")
the page in question is hosted at: http://lunik.co.uk/emil/drk/media.html'>http://lunik.co.uk/emil/drk/media.html (click the small green arrow below the menu, then click "visual spectacle > stream")
and the route folder where you can find all relevant scripts etc is at: http://lunik.co.uk/emil/drk
I'm supposed to hand this project in on friday and I have to create and entire research project, portfolio and presentation to go with it, all in one day. Due to this, I will hand it in without solving this problem if necessary but I'm a perfectionist and would really appreciate any help anyone can give me!! Also, I really want to learn more about how js works and solving this problem would be a small breakthrough for me. Please help!!!!
Thanks in advance!
Link to comment
Share on other sites
3 answers to this question
Recommended Posts