Search code examples
actionscript-3apache-flexflash-builderxmp

Working Example for as3-xmp library


I tried using the AS3-XMP Library to read metadata of the files, but i have no idea what methods to use.

Anyway one has any working example? so that i could learn from it? i manage to read all the TIFF structure / tags data, but i would like to know how to write it.


Solution

  • Did you follow all instructions here? Review the init function of the code sample for "how do I use this" reasons.

    I'll repeat the full instructions below:

    1. Download the as3_xmp_file, as3crypto and XMPCore libs
    2. Import the Flex Project archive files
    3. In the as3_xmp_file project under "Project" -> "Properties" -> "Build Path" -> "Library path" choose "Add project" and add the "XMPCore" project
    4. Create a new desktop application project
    5. In the new project under "Project" -> "Properties" -> "Build Path" -> "Library path" choose "Add project" and add the "as3_xmp_file" and "XMPCore" projects
    6. Insert the following source into your new projects main mxml file
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
      <mx:Script>
        <![CDATA[
          import de.qwesda.as3_xmp_file.as3_xmp_file;
          import com.adobe.xmp.*;
    
          private function init():void {
            var file1:as3_xmp_file = new as3_xmp_file(File.desktopDirectory.nativePath + "/test.jpg");
    
            if(file1.file.exists){
              trace(file1.xmp.dumpObject());
    
              var dc_exif:Namespace = XMPConst.dc;
    
              file1.xmp.dc_exif::title = "Title";
    
              file1.save();
            }
    
            var file2:as3_xmp_file = new as3_xmp_file(File.desktopDirectory.nativePath + "/test.jpg");
    
            if(file2.file.exists){
              trace(file2.xmp.dumpObject());
            }
          }
        ]]>
      </mx:Script>
    </mx:WindowedApplication>