Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Importing Flash (Actionscript 2) into Captivate 3

Guest
May 01, 2009 May 01, 2009

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

1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 04, 2009 May 04, 2009

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).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 08, 2009 May 08, 2009

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 08, 2009 May 08, 2009

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)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 08, 2009 May 08, 2009

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;
};
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 08, 2009 May 08, 2009

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 08, 2009 May 08, 2009

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 09, 2009 May 09, 2009
LATEST

Thanks for the tip!

Darin

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources