Topic: Video play - disable button. Video pause - enable button.

Hello all,

I am trying to figure out a way to enable and disable a button depending on wether a video is in pause (enable) or play (disable) condition.

I have tried to figure out if this can be done using only JavaScript coding but with no success.

Can it be done with JS or is there a need to use ActionScript in the fla? (I hope not!).

Please find the code below fyi. (Note it refers to external video_shell.fla, .flv and .swf files built using Adobe Flash CS3.)

Can someone look at the code supplied and point me in the right direction please?

Thanks very much.

<script language="javascript">
var flashObj;
function flashReady() {
//alert("flash ready");
    flashObj = document["video_shell"];
    var callResult = flashObj.play_video(1000); // play for one second
}
    if (AC_FL_RunContent == 0) {
        alert("This page requires AC_RunActiveContent.js.");
    } else {
    AC_FL_RunContent(
            'codebase', '[url]http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0[/url]',
            'width', '490',
            'height', '367',
            'src', 'video_shell',
            'quality', 'high',
            'pluginspage', '[url]http://www.macromedia.com/go/getflashplayer[/url]',
            'align', 'middle',
            'play', 'true',
            'loop', 'false',
            'scale', 'showall',
            'wmode', 'window',
            'devicefont', 'false',
            'id', 'video_shell',
            'bgcolor', '#BBBBBB',
            'name', 'video_shell',
            'menu', 'true',
            'allowScriptAccess','sameDomain',
            'allowFullScreen','false',
            'movie', 'video_shell?videofile=build_a_aircraft_640480r.flv',
            'salign', ''
            ); //end AC code
    }
</script>
<noscript>
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" 

codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="490" height="367" id="video_shell" 

align="middle">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="allowFullScreen" value="false" />
    <param name="movie" value="video_shell?videofile=build_a_aircraft_640480r.flv" /><param name="quality" value="high" /><param name="bgcolor" 

value="#e5e5e5" />    <embed src="video_shell" quality="high" bgcolor="#e5e5e5" width="490" height="367" name="video_player" align="middle" 

allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" 

/>
    </object>
</noscript>

I need something along the lines of:

function enabledisable()
{
    if(video is not playing)
    {
    document.getElementById('button').disabled = false;
    }
    else if (video is playing)
    {
          document.getElementById('button').disabled = true;
       }
}

Re: Video play - disable button. Video pause - enable button.

Resolved it myself by cheating.
I've placed the code below fyi.

function disableButton()
{
var tempdur="a duration value from program";

if(myValue=incorrect)
document.getElementById('button').disabled = false; 
else if((myValue=correct)
setTimeout("document.getElementById('button').disabled = true;",1)&&setTimeout("document.getElementById('button').disabled = false;",tempdur);
}