« Using SWF Metadata in Flash 8 | Main | Using the XPath API in Flash »

Automating Meta Data insertion using JSAPI

Listen to this article Listen to this article :: Talkr

As I mentioned in my previous post on Using Metadata in Flash 8, you can automate the process of inserting meta data into your Flash document by using JSAPI commands.

The code below creates a new FLA and addes the Title and Description to the newly created document.


// Create a new timeline-based FLA document

fl.createDocument();


// Retreive the document object (DOM) for the active FLA

doc = fl.getDocumentDOM();


// Intialize a variable with the current date

var today = new Date();


// Intialize a variable with the Title of the document

var docTitle = "Last ActionScript Hero : SWF Metadata Tutorial";

// Intialize a variable with the Description of the document

var docDesc = "This is a tutorial that teaches how to use SWF Metadata in Flash 8";

// Create a RDF XML in the specified syntax using current date, title and description

var rdfXML = '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/1.1/" dc:title="'+ docTitle +'" dc:description="' + docDesc+'" /><rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/" xmp:CreateDate="'+ today +'" xmp:CreatorTool="Flash Authoring WIN 8,0,0,215" /></rdf:RDF>';

// Add the RDF XML to the current document (Sets the meta data)
doc.setMetadata(rdfXML);


Copy & Paste the above code in a new JSFL file and save it as CreateDoc.jsfl and move this file to the commands folder : C:\Documents and Settings\<user>\Local Settings\Application Data\Macromedia\Flash 8\<language>\Configuration\Commands\

Restart Flash and choose Commands > CreateDoc

This will create a new FLA document with the specified Title and Description.

Donwload : CreateDoc.zip

TrackBack

TrackBack URL for this entry:
http://www.lastashero.com/tutorials/mt-tb.cgi/5

Questions & Comments

Really is functionally this metadata, when i save an archive in flash 8 whit this metadata and then view the properties of the archive this archive not contain the data.

Hi,

I am not able to undersatnd what you mean by saving an archive in Flash. When you say properties are you speaking about the file properties or the document properties?

Thanks,
KP

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)