Skip to main content
Lordrhavin
Inspiring
Jun 9, 2026 3:00 PM UTC
Answered

enum undefined

    var productFrame = app.activeDocument.textFrames.add();
productFrame.properties =
{
strokeWidth : 0,
fillColor : "None",
contents : "!",
flexItemHeightMode: FlexWidthHeightMode.FLEX_FILL
};

I get the error that “FlexWidthHeightMode is not defined”
What am I missing?

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#TextFrame.html
 

    Dirk BeckerCorrect answer
    Legend
    Jun 10, 2026 8:42 AM UTC

    @rob day Flex was added with version 21

    7 replies

    Legend
    Jun 10, 2026 8:41 AM UTC

    Could be that you are using

    • a versioned script (check app.scriptPreferences.version ?)
    • an old version (pre 21.0) that does not yet support flex
    • UXP / UXPSCRIPT without populating the enum from the require()

    ​@Mike Witherell FlexEnum only has FLEX_AUTO.

    Translate
    Mike Witherell
    Community Expert
    Community Expert
    Jun 9, 2026 6:27 PM UTC

    What happens if you change this line?

    flexItemHeightMode: FlexWidthHeightMode.FLEX_FILL

    changes to 

    flexItemHeightMode: FlexEnum.FLEX_FILL

    Translate
    Mike Witherell
    Peter Kahrel
    Community Expert
    Community Expert
    Jun 9, 2026 5:36 PM UTC

    Your code works fine over here on Windows 11 Pro and ID 2026 21.4.

    Translate
    rob day
    Community Expert
    Community Expert
    Jun 9, 2026 6:45 PM UTC

    Hi ​@Peter Kahrel , I’m getting the error on MacOS with InDesign 2025 (20.5.1)

     

    var pf = app.activeDocument.textFrames.add();
    try {
    pf.flexItemHeightMode = FlexWidthHeightMode.FLEX_FILL;
    }catch(e) {
    alert(e)
    }

     

     

    Translate
    Peter Kahrel
    Community Expert
    Community Expert
    Jun 9, 2026 6:53 PM UTC

    Looks like a Mac problem then.

    Translate