Displaying a list of Video objects in your Flash document’s Library panel using JSFL

by Peter deHaan on December 1, 2008

in JSFL

The following example shows how you can loop over items in your Flash document’s Library panel, filter out the video objects and display a list of the item name and video types.

Full code after the jump.

// JSFL
fl.outputPanel.clear();
 
var items = fl.getDocumentDOM().library.items;
if (items.length > 0) {
    for each (var item in items) {
        switch (item.itemType) {
            case "video":
                fl.trace(item.name + " (" + item.videoType + ")");
                break;
        }
    }
} else {
    alert("The current Flash document's Library is empty.");
}

Running this JSFL command produces output similar to the following (depending on what types of Video objects you have in your library, if any):

Embedded Video 1 (embedded video)
Embedded Video 2 (embedded video)
Video 1 (video)
Video 2 (video)

{ 0 comments… add one now }

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Previous post:

Next post: