Log in

View Full Version : Resolved How can I make my .swf play only when clicked?



mathewonsu
10-31-2009, 07:11 AM
The title explains it.
How can I make my .swf's play only when clicked?
I'm new to this and when I open a page I only want the .swf files to play when clicked on.
HTML or Javascript please.

I appreciate anyone who helps :D

kaos
11-03-2009, 01:00 AM
can i see an example?

davelf
11-03-2009, 01:18 AM
here you go:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!-- include flashembed. this file is not included in the "official" jQuery tools package -->
<script type="text/javascript" src="http://static.flowplayer.org/js/tools/tools.flashembed-1.0.4.min.js"></script>


<style>
#flash {
width:785px;
height:300px;
background-color:#333;
border:1px outset #000;
text-align:center;
cursor:pointer;

}

#flash h2 {
font-size:40px;
color:#fff;
margin-top:80px;
}

</style>



<script>
// script inside the domReady method is executed after page is scriptable
flashembed.domReady(function() {

// get flash container and assign click handler for it
document.getElementById("flash").onclick = function() {

// when being clicked -> load flash inside "this".
flashembed(this, "wall.swf");
}
});
</script>

<!-- our flash container with some initial HTML inside it -->
<div id="flash">
<h2>Click here to play movie</h2>
</div>



hope this help you, good luck.:)

davelf
11-07-2009, 02:31 AM
Hi mathew, i give you the files demo of that embed flash:

demo.zip (http://www.dynamicdrive.com/forums/attachment.php?attachmentid=2967&stc=1&d=1257561011)

for other information about this, see at:

play flash on click (http://flowplayer.org/tools/demos/flashembed/onclick.html)

Hope this will help you, good luck.:)

qikfire
11-24-2009, 07:36 PM
The title explains it.
How can I make my .swf's play only when clicked?
I'm new to this and when I open a page I only want the .swf files to play when clicked on.
HTML or Javascript please.

I appreciate anyone who helps :D
well, i suppose you could put a 'STOP' action on the first frame and a 'Play on mouse click' ACTION..

QIKFIRE