Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
This Kevlar connection class sets up encryption and handles socket transmission of data and messages to and from Photoshop.
public function KevlarConnection()
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Constructor. Creates a new Kevlar connection. No connection is attempted in this function, nor is the encryption set up.
Use the connect() and initEncryption() classes for these tasks.
public function connect(serverName:String, serverPort:int = 49494):void
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Opens a Kevlar data connection to Photoshop. You may call this function before you call initEncryption(),
but you will have to initialize the encryption before you can successfully communicate with Photoshop.
Parameters
| serverName:String — IP address or resolvable hostname of the server
|
|
| serverPort:int (default = 49494 ) — Port to connect to. Default is 49494
|
public function disconnect():void
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Disconnects the connection to Photoshop
public function encryptAndSendData(data:ByteArray):Boolean
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Will both encrypt and send data to Photoshop. However, it doesn't ensure that your data is properly formatted.
If you're interested in creating and dispatching properly formatted messages, look into the KevlarMessageDispatcher class.
Parameters
| data:ByteArray — The payload to encrypt and send
|
Returns | Boolean — Returns true or false based on whether the operations were successful
|
public function encryptData(data:ByteArray):Boolean
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Encrypts data such that Photoshop will be able to decrypt it. This won't ensure that your data is properly formatted, however.
If you're interested in creating and dispatching properly formatted messages, look into the KevlarMessageDispatcher class.
This function requires that the developer has already initialized the encryption.
Parameters
| data:ByteArray — The data to encrypt
|
Returns | Boolean — Returns true or false based on whether the operations were successful
|
public function initEncryption(password:String = Swordfish, salt:String = Adobe Photoshop, numIterations:int = 1000, numBytes:int = 24):void
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Derives the key necessary for all communication with Photoshop. This is a costly function. However, it must be called
before communication can be successful. It's recommended that you inform the user that initializing enryption will take some time before
calling this function.
Parameters
| password:String (default = Swordfish ) — The pre-shared password between Photoshop and your client.
|
|
| salt:String (default = Adobe Photoshop ) — The pre-shared salt between Photoshop and this client. This value should be available in Photoshop SDK documentation.
|
|
| numIterations:int (default = 1000 ) — The number of iterations the PBKDF2 password hash should use
|
|
| numBytes:int (default = 24 ) — The length of the derived PBKDF2 key, in bytes.
|
public function sendDatagram(data:ByteArray):Boolean
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Sends raw data to Photoshop, without encrypting it or wrapping it in a properly formatted message.
If you want to generate your own message and dispatch it, look at the KevlarMessageDispatcher class.
If you want to encrypt your data before pushing it to Photoshop, you'll want to use encryptAndSendData(), or encryptData()
Parameters
| data:ByteArray — The payload of data
|
Returns | Boolean — Returns false if the operation failed immediately.
|
Event Object Type: com.adobe.kevlar.events.KevlarEvent
KevlarEvent.type property = com.adobe.kevlar.events.KevlarEvent.CONNECTED
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Dispatched when the connection to Photoshop has been established
ConnectedEvent is dispatched after a connection was successfully established
Event Object Type: com.adobe.kevlar.events.KevlarEvent
KevlarEvent.type property = com.adobe.kevlar.events.KevlarEvent.DISCONNECTED
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Dispatched when the connection is terminated
Upon disconnection of a service or connection, a DisconnectedEvent KevlarEvent will be dispatched.
Event Object Type: com.adobe.kevlar.events.KevlarEvent
KevlarEvent.type property = com.adobe.kevlar.events.KevlarEvent.ENCRYPTION_SUCCESS
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Dispatched when the key has been encrypted, and the connection is ready to send and receive data.
Dispatched after encryption has been successfully initialized
Event Object Type: com.adobe.kevlar.events.KevlarEvent
KevlarEvent.type property = com.adobe.kevlar.events.KevlarEvent.ERROR
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Dispatched when there's been an error in either data transfer, encryption, or connection management.
ErrorEvent is dispatched in the case of an error. The data property will contain additional information regarding the error
Event Object Type: com.adobe.kevlar.events.KevlarEvent
KevlarEvent.type property = com.adobe.kevlar.events.KevlarEvent.IMAGE_RECEIVED
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Dispatched when the connection has received an image
Event Object Type: com.adobe.kevlar.events.KevlarMessageEvent
KevlarMessageEvent.type property = com.adobe.kevlar.events.KevlarMessageEvent.MESSAGE_RECEIVED
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Dispatched when a message is received from Photoshop.
A MessageReceivedEvent is dispatched when a service or connection has received an IMessage.
Event Object Type: com.adobe.kevlar.events.KevlarMessageEvent
KevlarMessageEvent.type property = com.adobe.kevlar.events.KevlarMessageEvent.MESSAGE_SENT
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Dispatched when a message is sent to Photoshop.
A KevlarMessageEvent with the MessageSentEvent is dispatched when a message has been successfully sent
Event Object Type: com.adobe.kevlar.events.KevlarEvent
KevlarEvent.type property = com.adobe.kevlar.events.KevlarEvent.PROGRESS
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Dispatched when there is progress in parsing a response or sending a message. Useful for large transfers.
ProgressEvent is dispatched when there has been progress made in sending, receiving, or parsing messages.
public static const KEVLAR_CONNECTION_API_VERSION:int = 1
The Kevlar API version that this code supports
Thu Mar 31 2011, 06:48 PM -04:00