codewala

code it

Disable mouse click events in Adobe Captivate from Flash 8

A friend of mine and myself were looking for a way to disable captivate mouse click events from flash, after hours of RnD on it found a very simple workaround to disable/enable mouse click events of Captivate from Flash8. Below are the steps.

1. Create following objects in Flash
– a movieclip having instance name cpContainer_mc
– two buttons having instance name disableListener_btn and enableListener_btn

2. Place your captivate file on the same path and name it as cp.swf

3. On the first frame of Flash paste this code

// prototype to disable listeners
MovieClip.prototype.disableListeners = function ()
{
// store old listeners
if(this.onMouseUp != null)
{
this.$_onMouseUp = this.onMouseUp;
}
// clear listeners array
this.onMouseUp = null;
}
//
// prototype to enable listeners
MovieClip.prototype.enableListeners = function ()
{
// set listeners back to previous state
if(this.onMouseUp == null)
{
this.onMouseUp = this.$_onMouseUp;
}
}
//
// code for the buttons
disableListener_btn.onRelease = function()
{
for(var i in cpContainer_mc)
{
if(typeof(cpContainer_mc[i]) == "movieclip" )
{
cpContainer_mc[i].disableListeners()
}
}
}
//
//
enableListener_btn.onRelease = function()
{
for(var i in cpContainer_mc)
{
if(typeof(cpContainer_mc[i]) == "movieclip" )
{
cpContainer_mc[i].enableListeners()
}
}
}
cpContainer_mc.loadMovie("cp.swf")

4. Compile and run the Flash file – click the buttons to enable/disable the Captivate mouse click events.

Advertisements

April 29, 2011 - Posted by | actionscript 2.0, Captivate, Flash

4 Comments »

  1. Hello, i am looking for something like this but for AS3, do you have any ideas on how this can be achieved? Im using captivate 6 and flash 6, and wanting to disable captivate buttons from a function from within the flash SWF.

    Thanks
    Nick

    Comment by Nick Gidman | November 12, 2012 | Reply

    • Hi Nick,

      I dont know how it is done in AS3.
      One suggestion – at the time when we need the captivate in disable mode – replace/hide captivate with a snapshot of it. It will make it look as if the captivate is disabled.

      Hope this was of some help.

      Regards,
      Sid

      Comment by Siddharth Lodha | November 13, 2012 | Reply

  2. extremely extremely helpful code – thanks Siddharth – one fix though :: // set listeners back to previous state if(this.onMouseUp != null) :: should actually be // set listeners back to previous state if(this.onMouseUp == null)

    Comment by karen | January 22, 2013 | Reply

    • Hi Karen,

      You are welcome. Have made the required correction in the code.

      Thank You,
      Sid

      Comment by Siddharth Lodha | January 24, 2013 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: