Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
The KevlarMessageDispatcher is an abstraction layer on top of the KevlarConnection, which makes it easy to send
properly formatted messages to Photoshop. You can either call some of the helper functions that will create and dispatch
the messages for you (createNewDocument, requestThumbnail, etc.), or create your own IMessage and call sendMessage().
public function KevlarMessageDispatcher(kc:KevlarConnection)
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Constructor. Creates a new KevlarMessageDispatcher.
Parameters public function createNewDocument(transactionID:int = -1, width:int = 640, height:int = 480, ppi:int = 72):void
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Dispatches a message instructing Photoshop to create a new document with the specified parameters.
Parameters
| transactionID:int (default = -1 ) — You can override the default value if you wish to send the message with a custom transactionID. If you leave it as
-1, the message dispatcher will keep track of transactionIDs for you. It's recommended that you don't mix these two systems,
as it might lead to conflicts and unpredictable behavior.
|
|
| width:int (default = 640 ) — The width of the document to create, in pixels
|
|
| height:int (default = 480 ) — The height of the document to create, in pixels
|
|
| ppi:int (default = 72 ) — The density of the document to create, in pixels per inch
|
public function requestThumbnail(transactionID:int = -1, width:int = 640, height:int = 480, format:int = 1):void
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Dispatches a message requesting that Photoshop return an image of the currently opened document.
Parameters
| transactionID:int (default = -1 ) — You can override the default value if you wish to send the message with a custom transactionID. If you leave it as
-1, the message dispatcher will keep track of transactionIDs for you. It's recommended that you don't mix these two systems,
as it might lead to conflicts and unpredictable behavior.
|
|
| width:int (default = 640 ) — The width of the returned image, in pixels
|
|
| height:int (default = 480 ) — The height of the returned image, in pixels
|
|
| format:int (default = 1 ) — The format of the returned image, according to the Photoshop API. Leaving this as 1 will return a JPG. Passing in other values
may have unintended effects, or require that you parse the returned image yourself.
|
public function sendMessage(message:IMessage):void
Takes an IMessage and sends it to Photoshop. The amount of time this function blocks will vary, depending on the
type of message, and its size. It will send the data in an asynchronous manner, but some requisite steps, such as converting
a Bitmap to a JPG, may take a short amount of time.
Parameters
| message:IMessage — The IMessage Object to send to Photoshop
|
protected static const MESSAGE_TEXT_DOCUMENTS_ADD:String = documents.add($1, $2, $3)
Creates a new document
protected static const MESSAGE_TEXT_DOCUMENTS_SEND_THUMBNAIL:String
Requests that Photoshop send us a JPG of the current document
protected static const MESSAGE_TEXT_SUBSCRIBE_COLOR_FOREGROUND:String
Instructs Photoshop to update us on the foreground color, whenever it's changed
Thu Mar 31 2011, 06:48 PM -04:00