Skip to main content
Gleeful_Odyssey6C29
Participant
February 8, 2017
Question

How can an AS3 widget change state of a Captivate object?

  • February 8, 2017
  • 2 replies
  • 503 views

How can an AS3 widget change state of  a  object in Captivate 9?

I can show of hide a object through as3,but I can't change state of a  object , Who can help me?

var slide:Object;       

var child:DisplayObject;

slide= parent.parent.parent;

for (var i:Number = slide.numChildren - 1; i >= 0; i--) {

child = slide.getChildAt(i);

if(child.name.substr(0,4)=="abc"){child.visible= !child.visible;} ;

This topic has been closed for replies.

2 replies

RodWard
Community Expert
Community Expert
February 8, 2017

Why do you need a widget to do this when it can be very easily done using normal Advanced Actions?

Gleeful_Odyssey6C29
Participant
February 8, 2017

i have many objests with “ABC” as a  prefix,and the project has many slides, I want to get these things done once in a while. Can you help me?

Lilybiri
Legend
February 8, 2017

You could also use Shared actions, I don't know if setting up a widget each time would save that much time over shared actions.

Gleeful_Odyssey6C29
Participant
February 8, 2017

How can an AS3 widget change state of  a  object in Captivate 9?

I can show of hide a object through as3,but I can't change state of a  object , Who can help me?

var slide:Object;      

var child:DisplayObject;

slide= parent.parent.parent;

for (var i:Number = slide.numChildren - 1; i >= 0; i--) {

child = slide.getChildAt(i);

if(child.name.substr(0,3)=="abc"){child.visible= !child.visible;} ;

TLCMediaDesign
Inspiring
February 9, 2017

I think you are going to have to output all of the children in your loop to see how Captivate is creating the states. I could be another movieclip or it could be a different frame or the same movieclip, you don't really know.

You could do a simple project with just the object and a state, don't use you widget, publish and use a Flash decompiler to see how it is created. SoThink has a great one with a trial. JPEXS also has other features

Gleeful_Odyssey6C29
Participant
February 10, 2017

I run the as3 code to  list all of the objects on the slide,

for (var i: Number = slide.numChildren - 1; i >= 0; i--) {

  child = slide.getChildAt(i);

  if (child.name) { captivateVariables["cpisondomain" + i] = child.name; }

   }

}

I use the code to show or hide a object,  it  works.

  if(child.name.substr(0,1)=="a"){child.visible= !child.visible;} ;

But the way of  controlling button  in captivate is too complex Generally a button has three states, if you add a state, there will be four states. The icons of the following three states are named after Item_number. Each button also has a clickArea object and a normal icon. I can show or hide an icon, but the clickArea of the button remains. Captivate still records the status and action of the button before.if I revist the slide , the button will return to the original state.

I want press one click  to show or hide many objects in captivate,and Now I have to spend more time doing these work by share actions。