Linkage ID Standards

I mentioned in a previous post that we have developed standards for assigning linkage IDs here at gskinner.com, and a few people expressed interest in them so here’s a quick post to explain our two main standards, and a JSFL script to help keep your library nicely organized.


All of our code resides in class files, so all of our library assets are either bound to a class, or are contained within a clip that is bound to a class. Because we want to maintain obvious relationships between our clips and their associated classes, we mirror the full package path & class name for our clip linkages. Similarly, we also maintain our library structure to mirror our package paths.

So for a clip bound to the class “com.gskinner.controls.ComboBox”, the clip would:

  • be named “ComboBox”
  • sit in a directory path of “com/gskinner/controls/” in the library
  • have a linkage ID of “com.gskinner.controls.ComboBox”

That takes care of classes bound to classes, but what about clips that require a linkage ID, but do not have a class bound? Because these clips will almost always be an asset of a bound clip, we can use the namespace of the bound parent clip, append a colon “:”, and add a unique identifier. We also dump these assets into a directory called “ParentClipName assets” in the library.

So a “RowRenderer” clip that is an asset of “com.gskinner.controls.ComboBox” would:

  • be named “RowRenderer”
  • sit in a directory path of “com/gskinner/controls/ComboBox assets” in the library
  • have a linkage ID of “com.gskinner.controls.ComboBox:RowRenderer”

You’ll notice that the names of these clips are capitalized. I like to capitalize library item names, as they are the visual equivalent of classes (ie. the template that clip instances are created from), and class names should always be capitalized.

To make all of this a little easier, I have created a simple JSFL script that organizes your library according to linkage IDs. For example, if you created a clip with the linkage “com.gskinner.controls.ComboBox:RowRenderer” in your library, and ran the JSFL, it would create the directory path “com/gskinner/controls/ComboBox assets” in your library if needed, and move the clip there.

You can download it by clicking here. As always, you might want to run this on a copy of your FLA – there’s always the chance it’ll mess up your library. Let me know in the comments if you have any problems, or ideas for enhancing this script.

Grant Skinner

The "g" in gskinner. Also the "skinner".

@gskinner

6 Comments

  1. sounds good, but what about multiple library assets be assigned to the same Class? or do you think this is bad practice?

    This comes up somewhat frequently for me.

  2. I don’t think its bad practise to use the same class with multiple symbols. In fact, I’d encourage it. Using the qualified class name is great for compiled components, and I do the same thing myself. But sometimes its really handy to use classes that apply to lots of different symbols – and that’s a really cool thing to be able to do. In this case, I usually use the symbol name as linkage id, without the class package. This is unlikely to cause a problem because Flash will tell you when two symbols have the same linkage and swfs can’t see each other’s libraries at runtime. I can’t guarantee that this is safe with RSLs, but I can’t think of a non-functioning example, off-hand.

  3. I mostly agree with Peter… though we have had occasions where Flash failed to catch duplicate linkage IDs (hijinks ensued). In most cases, clips that share classes are treated as assets of other clips, and so we can assign IDs according to the second standard.

    For example, we have a class called GraphicButton that we bind to clips that require button functionality, but use custom graphics that wouldn’t fit in a component. If I had a save button that used GraphicButton in a view called “ContactList”, I would give it a linkage of “com.myproject.views.ContactList:Save”.

    Good question. Cheers.

  4. How do u handle class naming for components specific to certain applications. I have several general components and sometimes i need to combine these into a component thats specific to an application just wondering how u organise ure package structure…

    nik

  5. I have a hard time understanding this. I am having problems accessing linkage ids for a project I am working on.

    I have an application which creates an empty movie clip called: “course_mc” which contains my library assets and within it I create an empty movie clip (called “interface_mc”) that would load my interface shell. However, I could not access my assets within course_mc.interface_mc. I am wondering what I am doing wrong.

    Help! David

  6. Hi there!

    Do u take part in dev the new advanced text comp?

    Like this one: URL=http://www.adobe.com/products/flashplayer/features/features/Vellum.swf

    I’m askin’ as it has com.gskinner.controls.TextEngineLabel class inside.

    Btw any news on release date of those comps? Adobe is keepin’ mum, as always…

Leave a Reply

Your email address will not be published. Required fields are marked *