Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Linking a text parameter to a slider

  • Linking a text parameter to a slider

    Posted by Josh Kurz on November 16, 2009 at 9:51 pm

    Hi,

    A have a precomp within a master comp. I have a number of layer in a precomp whose position are all linked to another layer (NULL 2) in the master comp which looks like this:

    comp.(“MasterComp”).layer(“NULL 2”).transform.position

    The project will have to go through multiple revisions so I’ll be making multiple versions of the master comp. I’ll also have to duplicate the precomp and then replace every time I make a new version to insure that each new version is self contained and I’m not messing up any previous comps. Since this means that I’ll have to edit the expression in each layer of the new precomp is there a way of linking the name of the master comp to a slider? So basically instead of having to write MasterCompV2, MasterCompV3, etc. over and over again in each of the layers of the precomp, if I could do something like MasterCompV(Slidercontrol) I would just have to type in one number and that would save me a ton of work/time.

    Any thoughts?

    Thanks in advance for all your help,

    -Josh

    Josh Kurz replied 16 years, 5 months ago 2 Members · 2 Replies
  • 2 Replies
  • Xinlai Ni

    November 16, 2009 at 11:03 pm

    Javascript supports implicit conversion from number to string, so
    "foo" + (Math.floor(thisComp.layer("control").effect("Version Slider")(1)))
    gives you “foo1” if your slider’s value is >= 1 but < 2, etc. Xinlai Ni Software Engineer, Google Inc.

  • Josh Kurz

    November 17, 2009 at 9:56 pm

    THanks for the quick response!
    So here’s the expression I made based on yours:

    comp(“TestV” + (Math.floor(thisComp.layer(“VersionControl”)(“Slider”)(1)))).layer(“MOVER”).transform.position

    But I’m getting this error:

    Expected:;

    Error ocurred at line 1.
    Comp:’PrecompTestV1′
    Layer: 2 (‘Null137’)
    Property: ‘Position’

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy