Adobe 65007312 Programming Guide - Page 126
Creating the Flash movie, Lightroom takes a screenshot of the Flash movie - flash 10
UPC - 883919154398
View all Adobe 65007312 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 126 highlights
CHAPTER 6: Writing a Web-engine Plug-in Defining the data model 126 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 entry in iconicPreview, at the top level of the _root object. 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 ready, which Lightroom will poll waiting for your preview 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 "yes", Lightroom takes a screenshot of the Flash movie and 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 numCols Flash variable.