FDT Templates Specifier Feature

Posted 25 July 2010 by

Quick tip for the FDT templates

Have you ever wondered how to make one of those nifty little “drop-downs” in your templates? Well it’s really easy! Here is a tutorial on how to create a generic variable declaration for your AS3 classes.

Open your preferences FDT -> Editor -> Templates

FDT -> Editor -> Templates

FDT -> Editor -> Templates

Create a “New” template

FDT var Template New Window

FDT var Template New Window

At the “name” field enter “var” – remember that this field is the one that is recognised by FDT‘s auto-complete, so keep it lower case. “Context” and “Automatically insert” will be correct at default. Enter a nice description which will display when the auto-complete list comes up.

FDT var Template Auto Complete

FDT var Template Auto Complete

Okay, getting to the fun part, the “Pattern” field. There you can pretty much do what you want, but in this small tutorial we are focusing on the “specifier” feature most people don’t know about. It works the same as inserting a variable in, so the syntax starts off the same.

${specifier:value(item1,item2,itemN)}

You can specify as much items as you want, also the order you provide is preserved. I usually use “protected” variables the most so I have it first here, so in most cases I just press enter, otherwise I just use the up/down arrow keys to select the one I need.

Results

FDT var Template Specifier List

FDT var Template Specifier List

Using the specifier will speed up your development and cut down on some frustration. Hope you all find joy in using the specifier feature, I certainly have. :)

Post Details

  • Pingback: Tweets that mention FDT Templates Specifier Feature | Matan Uberstein | AS3 Blog -- Topsy.com

  • http://www.nook.se nook

    Nice tip! But in what way does this differ from
    ${value:value(1,2,3)}, except from a maybe less ambiguous syntax?

  • http://www.nook.se nook

    Actually, after some investigation it seems to me that this is how it works:
    ${foo} … ${foo}
    Change one and it changes in the other

    ${foo:value(1,2,3)} … ${foo:value(1,2,3)}
    Choose value in one and it changes in the other

    ${bar:value(1,2,3)} … ${bar:value(1,2,3)}
    ..works just the same.

    So it seems “specifier” is not a hidden parameter, it can be anything. What matters is if you write “:value(…)” after the parameter name.

    :razz:

    • http://doesflash.com Matan Uberstein

      Aaah very nice, thanks for posting. I found this “feature” by looking at some of FDT’s default templates and just ran with that. Never really tried it out by changing the “specifier”.

      But yeah, really cool. So you can actually make groups of these lists by setting the name the same as the normal ${name} works.

      Once again, thanks for posing! :mrgreen:

      • http://www.nook.se nook

        Yeah. Pretty cool!
        If you click the “Insert variable..” button “value” is represented there but if you choose it you only get “${value}” which doesn’t give you any clue how to use it. Should’ve been “${name:value()}” or something.
        cheers