Forum Moderators: open

Message Too Old, No Replies

Use javascript to control flash files?

I want to use javascript to un/pause flash music...

         

JAB Creations

3:10 am on Jan 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I want to make a flash image that when clicked on will pause the music being played by flash. Clicking again will unpause it (not stop/play as this resets the track).

I haven't found anything on the web except for javascript IN flash which is not what I'm trying to do.

jbot

11:45 am on Jan 31, 2005 (gmt 0)

10+ Year Member



try calling this function from a hyperlink, where oId is the id of object calling the SWF:


function pauseFlash(oId)
{
document.getElementById(oId).PausePlay();
}

JAB Creations

3:28 pm on Jan 31, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How would I format that in to a hyperlink?

<a href="javascript: ...?

jbot

3:52 pm on Jan 31, 2005 (gmt 0)

10+ Year Member



how do you think?

<a href="#" onclick="pauseFlash('mymovie');" ...>

<object id="mymovie" ...>

JAB Creations

4:45 pm on Jan 31, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well here is what we have so far. How do you know if flash will recognize javascript commands outside of the flash itself?

<html>
<head>
</head>
<body>

<script>
function pauseFlash(mymovie)
{
document.getElementById(mymovie).PausePlay();
}
</script>

<a href="#" class="mp" onclick="pauseFlash('mymovie');">Pause</a>
<br />
<br />
<br />
<br />
<object type="application/x-shockwave-flash" data="jab-creations-2.6-06-lo.swf" id="mymovie" width="1" height="1">

<param name="movie" value="jab-creations-2.6-06-lo.swf" />
<param name="loop" value="false" />
</object>

</body>
</html>

JAB Creations

10:18 pm on Jan 31, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've got this solved! Visit my site and play the music and use the pause button if you want to check it out! :-)