Skip to main content
Participant
December 16, 2021
Answered

Connecting font to drop down menu

  • December 16, 2021
  • 2 replies
  • 317 views

Hi all, I have looked all over for an answer and haven't found it. Sorry if it was overlooked. I'm sure this is a super simple item I am missing.

 

I am trying to create a text layer that changes the font based on a Dropdown Menu control. The below code is the example code that Adobe gives to begin exploring this tool but I always get the error I've placed beneath that.  Can anyone point me in the right direction?

 

Expression:

var dropDownMenu = thisComp.layer("LayerName").effect("Dropdown Menu Control")("Menu"); 
  
switch (dropDownMenu.value) { 
  
    case 1 : 
  
        text.sourceText.style.setFont("Georgia"); 
  
        break; 
  
    case 2 : 
  
        text.sourceText.style.setFont("Impact"); 
  
        break; 
  
default : 
  
        text.sourceText.style.setFont("Tahoma"); 
  
}

 Error:

 

Thanks for any help.

This topic has been closed for replies.
Correct answer Dan Ebberts

It works for me. My guess is that you have Project Settings > Expressions set to Legacy ExtendScript.

2 replies

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
December 16, 2021

It works for me. My guess is that you have Project Settings > Expressions set to Legacy ExtendScript.

TrevorPAuthor
Participant
December 16, 2021

Oh my goodness. Thank you!! I thought I was going crazy. This now works.