Importing Flash (Actionscript 2) into Captivate 3

Copy link to clipboard
Copied
I recently needed to create some buttons that would show an image when the button is clicked and hide it when you click the button again. Since this capability does not appear possible in Captivate 3, I created a button with the appropriate image in Flash. It works fine when I test the Flash file or run it by itself. However, it does not appear to work properly when I insert it into Captivate as an animation. The up, over, and down posistions work on the button, but the image does not display when the button is pressed. The following code was used in Flash:
(keyframe script)
// when swf is loaded
myMC1.onLoad()
{
myMC1._visible = false;
}
(button script)
//when our button pressed:
on(press)
{
//check if its visible
if (myMC1._visible == true) {
//if it is make them invisible
myMC1._visible = false;
} else {
//otherwise make them visible
myMC1._visible = true;
}
}
Any ideas why it works on its own, but not in Captivate?
Darin
Copy link to clipboard
Copied
in my experience, when SWFs are imported into Captivate, their internal movieclips get renamed, which can cause problems when you import SWFs that rely on named references. try decompiling a Captivate SWF sometime, it's pretty fascinating.
you could try using a moviecliploader in your child swf to load the image(s) from an external URL (as opposed to embedding them in your Flash SWF).

Copy link to clipboard
Copied
I have since tried a different set of code and had some positive results. I used the following in first_btn:
on(press){
if(firstmc._visible)
{
firstmc._visible=false;
}
else
{
firstmc._visible=true;
}
}
This code works just fin in Captivate 3. The only issue I had then was to initially hide the movieclip. To do that I tried the following code in my movieclip firstmc:
onClipEvent(load) {
firstmc._visible=false;
}
This worked in so far as it hid the movie clip when I ran the swf. However, now the button does not show the movie clip when clicked. Any ideas?
Darin
Copy link to clipboard
Copied
in theory it would be better to put all of your code in the first frame of the timeline and avoid attaching scripts on objects. for instance, if your button's instance name is "mybtn" and the movieclip you want to show/hide is "mymc", you could use the following code (on main timeline, first frame):
mymc._visible = false; mybtn.onRelease = function (){ mymc._visible = !mymc._visible; };
(see attached FLA)
Copy link to clipboard
Copied
in theory it would be better to put all of your code in the first frame of the timeline and avoid attaching scripts on objects. for instance, if your button's instance name is "mybtn" and the movieclip you want to show/hide is "mymc", you could use the following code (on main timeline, first frame):
mymc._visible = false;
mybtn.onRelease = function (){
mymc._visible = !mymc._visible;
};

Copy link to clipboard
Copied
Success! Since my last post, I removed the movieclip script and created a frame script with the following function:
function noshow() {
firstmc._visible=false;
}
noshow();
This hides the movieclip initially and the button script shows and hides it when clicked. It works alone in a swf as well as an swf within Captivate 3.
Darin
Copy link to clipboard
Copied
you replied before i finished typing my last reply.
glad you got it working. note you can use the simplified mc._visible = !mc._visible for toggling the visibility of an object (this will make the visibility the opposite of whatever it currently is)
cheers

Copy link to clipboard
Copied
Thanks for the tip!
Darin

