Copy link to clipboard
Copied
hi, I have created button in flash and wrote the below code and placed it in first slide of Captivate. I am using captivate 6. When I click that button it should go to captivate slide 4.
import flash.events.MouseEvent;
import flash.display.MovieClip;
//Get a reference to the Cp main movie
var myRoot:MovieClip = MovieClip(root);
var mainmov:MovieClip = MovieClip(myRoot.parent.root);
//Attach an eventlistener to your flash button
this.btn.addEventListener(MouseEvent.CLICK, btnClick_Handler);
//write the function to handle the click even of your button
function btnClick_Handler(e:MouseEvent):void {
mainmov.rdcmndGotoSlide = 4;
return;
}
Please help me for this.
Thanks in Advance.
Reji.
Copy link to clipboard
Copied
Double post. Please, don't do that.
Copy link to clipboard
Copied
removed the first one.
Copy link to clipboard
Copied
You have a couple of issues in your code.
1. In your function the "void" at the end means that the function is not expected to return anything, so you should remove "return".
2. You don't need "this" before the button instance name when adding the event listener.
3. When you go to the new slide the project will be paused.
CP still uses rdcmnd and cpCmnd syntax for certain commands.
I don't have CP6 on my current machine, but the following code should work for you. Make sure the your button has an instance name, in my example it is "myNext".
import flash.events.MouseEvent;
import flash.display.MovieClip;
var cpRoot:MovieClip = MovieClip(root);
var mainmov:MovieClip = MovieClip(cpRoot.parent.root);
myNext.addEventListener(MouseEvent.CLICK, nextClick);
function nextClick(e:MouseEvent):void
{
if (mainmov.rdcmndGotoSlide)
{
mainmov.rdcmndGotoSlide = 4;
mainmov.rdcmndResume = 1;
}
else
{
mainmov.cpCmndGotoSlide = 4;
mainmov.rdcmndResume = 1;
}
}
Copy link to clipboard
Copied
Thanks alot. Its working fine.