Jump to content

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


draig_hand

Recommended Posts

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.

 



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">



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

/>

 

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;
      }
}

Link to comment
Share on other sites

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);
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...