Skip to main content
bala281972
Known Participant
August 11, 2012
Answered

buttons-how to get properties of goto state action from the menu

  • August 11, 2012
  • 1 reply
  • 1363 views

hey, i'm writing a script which will tell me the name of the state assigned to a button, in this case, the button is assigned to a state 2. the command alert (buttons[0].properties.gotoStateBehaviors) displays 'undefined' any suggestion ?

This topic has been closed for replies.
Correct answer tomaxxi

thats awesome. can u help me to find out the value of 'state' name also

when i give alert(app.documents[0].buttons.gotoStateBehaviors[0].associatedMultiStateObject.name); it gives me the value as 'Multi-state 12', but couldn't get the value 'State 2', please refer the picture i've attached earlier.

any thought ?


Change "name" to "stateName".

Make sure you take a look at third link that Jongware posted.

All info is there!

Hope that helps.

--

Marijan (tomaxxi)

http://tomaxxi.com

1 reply

Inspiring
August 12, 2012

Buttons are not something that I use in ID but at a glance Im not sure that you require the '.properties' so try something like…

alert( buttons[0].gotoStateBehaviors.firstItem() );

ONLY my guess though…

Jongware
Community Expert
Community Expert
August 12, 2012

Fair guess :)

1. http://jongware.mit.edu/idcs6js/pc_Button.html -- select "gotoStateBehaviors"

2. http://jongware.mit.edu/idcs6js/pc_GotoStateBehaviors.html -- select the singular

3. http://jongware.mit.edu/idcs6js/pc_GotoStateBehavior.html -- here are the properties per item.

The first, "gotoStateBehaviors" as a property of "Button", is marked as "collection" because you can have more than one.

So the command to drill down to the first state of a button and fetch its name is

buttons[0].gotoStateBehaviors[0].name

bala281972
Known Participant
August 13, 2012

thats awesome. can u help me to find out the value of 'state' name also

when i give alert(app.documents[0].buttons.gotoStateBehaviors[0].associatedMultiStateObject.name); it gives me the value as 'Multi-state 12', but couldn't get the value 'State 2', please refer the picture i've attached earlier.

any thought ?