Follow along with this tutorial to create a Hello World Flash panel for Photoshop. In this exercise, you will create a Flash plug-in within a Flex Builder MXML project. When you run the Flash panel within Photoshop, it will send code to Photoshop that when executed, will display an alert dialog box with a message.
After completing this tutorial, you should be able to:
In order to make the most of this article, you need the following software and files:
You must be comfortable with developing in Flex Builder. Basic familiarity with ExtendScript ToolKit would be beneficial, but is optional. You should have already worked through the Hello World examples for Photoshop panels (using the CSXSLibrary.swc), SwitchBoard and PatchPanel.
Steps
That should return you back to the Flex Builder Import Flex Project dialog box. From here, click the Finish button to import the project into Flex Builder.
Note: Open up the imported project folder. You will find a src folder that contains the basic files we will use to construct this example. In the solutions folder, the final and incremental source files are included for reference.
Let's start by opening /src/HelloWorldEnhanced.mxml.
Note: The CSXS SWC is already in the libs directory of the project and it has already been imported into our ActionScript.
The first thing we need to do is create a method that is called after the creation of the Adobe AIR application is complete.
public function onCreationComplete(): void { }
Next, we need to call onCreationComplete.
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCreationComplete()">
Now we need to add some code within the onCreationComplete method that will be send to the host application, Photoshop in this case, to be evaluated.
CSXSInterface.instance.evalScript("alert('Woohoo! Hola World!')");
Where CSXSInterface.instance provides an interface to the target application and evalScript will evaluate the script when it reaches Photoshop. The script to be evaluated is simply a one-line script: alert('Woohoo! Hola World!').
Our code should look like solutions/HellowWorldEnhanced-fin.mxml. Verify it does before proceeding.
Now it is time to install our SWF so that Photoshop can run it as a Flash panel.
Click on Finish.
Note: If you already have a copy of the swf you are creating in this directory, Flex Builder will prompt you with a replace dialog box titled 'Question'. If so, click on Yes To All. You can then skip the next step because a link to that file will already be established within Photoshop.
In the menu Window > Extensions select HelloWorldEnhanced. Your Flash panel should open up and an alert dialog should popup as well with the 'Woohoo! Hola World!' message.
Note: If you need to make changes to your code, when you are finished, repeat steps 11-17 to continue testing your SWF from within Photoshop.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
Dr. Woohoo (translation: Serious Fun), is a New Mexico-based artist, designer and developer creating work for a wide range of clients, including Adobe, Taylormade-Adidas Golf, Nike Golf and Camelbak. Working with digital media since 1993, Woohoo has done many professional projects, which are available at blog.drwoohoo.com and at Dr. Woohoo on Flickr.