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)

 

Leave a Reply

Your email address will not be published.

You may 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="" highlight="">

Spam Protection by WP-SpamFree