Adobe Flash JSFL quirks notes:

  • Text boxes may store line returns as \r, rather than \n or \r\n.
    • Because of this, the beginning of line symbol may not work. 
    • Wrong: string.replace(/.*^.*/, “$1”); 
    • Right: string.replace(/.*\r.*/, “$1”);
  • Non-greedy seraches don’t always work, and may not work with multiline searches.  Try a greedy search instead, if possible.  Headache == string.replace(/^(.*?)\r(.+?)/m, “$1”).
  • Using fl.findObjectInDocByType(),
    • [obj].keyframe = The keyframe that the element is on.
    • [obj].layer = The layer that the keyframe is on.
    • [obj].timeline = The timeline that the layer is on.
    • [obj].parent = The parent of the timeline. E.g., the timeline might be in a symbol instance.

    And finding the layer and frame:

    • dom.getTimeline().currentLayer = dom.getTimeline().findLayerIndex(findObjResults[j];
    • dom.getTimeline().currentFrame = findObjResults[j].keyframe.startFrame;
  • Using:

    var dom = fl.getDocumentDOM();
    var lib = dom.library;

    Find a library item:

    var libItem = lib.getItemByname( libItemRef );

    Find a library index:

    var libIdx = lib.findItemIndex("folder-as-path/to/library/item/name");

    Select an element on the stage:

    fl.selectElement( someStageElementRef, false );

    Swap element’s library item with another library item:

    dom.swapElement( );

  • For basic stage DOM search (and swapping) for library item instances see my post on JSFL swaps.