Unlimited Plugins, WordPress themes, videos & courses! Unlimited asset downloads! From $16.50/m
  1. Code
  2. ActionScript

Quick Tip: Use AS3 to Grab Exif Data From a JPG Image

Read Time:2 minsLanguages:

Exif, or Exchangeable image file format is a specification for image formats used by digital cameras and scanners. It's also used to store metadata such as camera model, type, author etc. Learn to display Exif metadata in your application by following this Quick Tip.

Step 1: Brief Overview

We'll use an excellent library to load and parse the Exif information of a JPG file; the data will be then displayed in a Dynamic TextField. You can download the library from the developer's site.

Step 2: Set Up Your Flash File

Launch Flash and create a new Flash Document, set the stage size to 320x480px and the frame rate to 24fps.

Step 3: Interface

This is the interface we'll be using; nothing fancy, just a TextField in Stage called infoTF. The image will be dynamically loaded using ActionScript.

Step 4: ActionScript

Create a new ActionScript Class (Cmd+N), save the file as Main.as and write the following lines. Please read the comments in the code to fully understand the class behavior.

Step 5: Document Class

Remember to add the class name to the Class field in the Publish section of the Properties panel.


Use this library to access the metadata in your jpg file. Remember that some image editors remove the data when compressing, in which case an error will be thrown by the player.

I hope you liked this Quick Tip, thank you for reading!

Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.