Adobe 65007312 - Photoshop Lightroom Programmer's Manual page 126

Mac
Hide thumbs Also See for 65007312 - Photoshop Lightroom:
Table of Contents

Advertisement

C
6: Writing a Web-engine Plug-in
HAPTER
Creating the Flash movie
Your web-engine folder must include a simple Flash movie that renders the "iconic" representation of each
web page. The ActionScript file that defines your movie can access the global variables provided by the
flashvar
Your Flash movie should do these things:
1. Set the stage behavior:
Stage.scaleMode = "noScale";
Stage.align = "tl";
This ensures that your preview renders without stretching or distortion.
2. Create an external interface callback called
to finish drawing:
_root.ready = 'no';
_root.readyFunc = function(str:String) {
return _root.ready;
}
ExternalInterface.addCallback("ready", _root, _root.readyFunc);
Then at a later time (usually in a subsequent frame):
_root.ready = 'yes';
Once your ready function returns
terminates its execution (in order to reduce CPU usage)
3. Initialize default values, so that you can preview your movie without running it in Lightroom.
var numCols;
if( _root.numCols != null ) {
numCols =parseInt( _root.numCols );
}
else {
// default value
numCols = 4;
}
Do this for each model property you are using in your preview.
4. Draw the preview. This can be done by rearranging existing objects that you created in Flash, or simply
by using the drawing primitives of the ActionScript programming language. For example:
var cellSize = 10;
for( x = 0; x < numCols; x++ ) {
_root.beginFill( cellColor, 100 );
_root.moveTo(x*cellSize, y* cellSize );
_root.lineTo( (x+1)* cellSize, y* cellSize );
_root.lineTo( (x+1)* cellSize, (y+1)* cellSize );
_root.lineTo( x* cellSize,+ (y+1)* cellSize );
_root.endFill();
}
This draws as many rectangle as are specified in the
entry in
iconicPreview
, at the top level of the
, which Lightroom will poll waiting for your preview
ready
, Lightroom takes a screenshot of the Flash movie and
"yes"
numCols
Defining the data model 126
object.
_root
Flash variable.

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Photoshop lightroom sdk 3.0

Table of Contents