Using the Photoshop Touch SDK; Creating a Project


Introduction

I wrote an article that will soon be up on the Adobe Developer Connection: “Controlling Photoshop with Flex and AIR using the Photoshop Touch SDK.” It guides you through using APIs I wrote with the help of my colleague Renaun Erickson.

The article will contain the following:

  • Setup: Creating a Project
  • Code: Connecting to Photoshop
  • Code: Sending Commands to Photoshop (creating a new document)
  • Code: Managing Subscriptions and Color Change Events
  • Code: Sending Custom Messages to Photoshop

I’m quite eager to share this information and teach developers about connecting their Flash, Flex, and AIR apps to Photoshop CS 5. Though my article isn’t posted yet, today I’m going to share the first section, which will show you how to link to the required libraries in a Flex mobile project.

Update 6/16/2011: The full ADC article is now live.


Requirements

Software

  • Photoshop CS 5 12.0.4 or later (update CS 5 from within Photoshop)
  • Flash Builder 4.5 (or an IDE of your choice) with the Flex 4.5 SDK

Libraries


Step 1: Create a new Project in Flash Builder

The first step is to create a new Flex mobile project. Although we’re using Flex, the Flash runtime runs on a variety of platforms and devices, so you could just as easily create an AS3 or AIR project. For this article, though, we’ll focus on creating a mobile Flex app.

  1. Open Flash Builder and go to File -> New. Select Flex Mobile Project.
  2. Enter a project name, and choose a location. Click next.
  3. Make sure Google Android is your target platform, and select “View-Based application.”
  4. Name your initial view “LoginView.” It’s here that you’ll write code to handle the connection to Photoshop.
  5. Click finish to complete the new Flex mobile project.


Step 2: Link to the Photoshop Touch SDK library

The Photoshop Touch SDK includes a file called PhotoshopTouchSDK.swc. This is a pre-compiled library that you can integrate into any Flash or Flex applications, which provides APIs to connect to and control Photoshop. This part of the library is open source, and you are free to modify and learn from the code (in accordance with the accompanying EULA and/or license agreement).

When you downloaded and extracted the Photoshop Touch SDK from the Adobe site (http://www.adobe.com/devnet/photoshop.html), it will have created the PhotoshopTouchSDK.swc file in the following relative location:

(some directory)\samples\air\photoshoptouchsdk\bin\PhotoshopTouchSDK.swc

  1. Locate the PhotoshopTouchSDK.swc file in the extracted files.
  2. Copy PhotoshopTouchSDK.swc and paste it in the “libs” folder inside your project directory. You can do this from within Flash Builder, or using Explorer/Finder/bash/etc.


Step 3: Link to the other required libraries

The file (some directory)\samples\air\photoshoptouchsdk\README.txt will indicate the complete list of libraries that are necessary to use the APIs. At the time of this writing, there are three additional libraries you have to include:

  • as3corelib (https://github.com/mikechambers/as3corelib)
  • as3crypto (https://code.google.com/p/as3crypto/)
  • StructuredLogTestingSDK (for logging) (https://code.google.com/p/structuredlogtesting/)

Obtaining these libraries is relatively straight-forward. Follow the included links (or use Google). At the time of this writing, you can take the following steps on the libraries’ respective sites:

  • Click the grey “Downloads” button for as3corelib and obtain “as3corelib-.93.zip.” Extract this and open “lib,” and you’ll see the as3corelib.swc file.
  • For as3crypto, click the “Downloads” link and obtain “as3crypto.swc.”
  • For StructuredLogTestingSDK, click the “Downloads” link and get “StructuredLogTestingSDK-1.3.swc.”

Take these three SWCs and drop them into the “libs” directory in your project, as you did with the PhotoshopTouchSDK SWC.

Your project should link to these four libraries

Your project should link to these four libraries


Conclusion

At this point your project is configured, and you can begin using the Photoshop Touch SDK for AS3. Refer to the ASDocs that are included in the SDK, and check back soon for a link to the full ADC article.

Update 6/16/2011: The full ADC article is now live. Read that article to learn more about using the Photoshop Touch SDK.