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

Issue with mouse enter/exit for buttons to show/hide layers

Explorer ,
Mar 28, 2023 Mar 28, 2023

I have created a PDF with five buttons over different text to reveal a message for each with a mouse-over. The messages are in layers ("Layer2" through "Layer6"), and I found a script from another thread to add to the Mouse Enter and Mouse Exit actions for each button. But the script does not perform any action or produce any errors when I view it in the debugger. My script below is an example of Mouse Enter for Layer2. The "ocgArray1[i].state = false" for Mouse Exit. Any help would be greatly appreciated.

var ocgs = this.getOCGs() ;
var ocgArray1 = this.getOCGs();

for (var i=5; i < ocgArray1.length; i++) {

if (ocgArray1[i].name == "Layer2") {
	ocgArray1[i].state = true;
	} 

} 
TOPICS
General troubleshooting , JavaScript , PDF forms
575
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
1 ACCEPTED SOLUTION
Community Expert ,
Mar 28, 2023 Mar 28, 2023

Why are you starting the loop from 5, instead of 0?

View solution in original post

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
Community Expert ,
Mar 28, 2023 Mar 28, 2023

Why are you starting the loop from 5, instead of 0?

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 ,
Apr 05, 2023 Apr 05, 2023
LATEST

Thank you for pointing that out, Try67! I wondered about that from the example in the discussion I pulled this from but tried it out. When I changed it to zero, it worked.

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