Adobe 0046100128056 Scripting Guide - Page 155
an example of using a set of buttons to control the playback of a moving file for the complete script, refer
UPC - 718659087562
View all Adobe 0046100128056 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 155 highlights
CHAPTER 11: Creating Dynamic Documents Creating Buttons 155 //Given a page "myPage" in a document "myDocument," containing the colors //"Blue" and "Red"... //Make a button "from scratch." var myButton = myPage.buttons.add({geometricBounds:[72, 72, 144, 144], name:"GoToNextPageButton"}); var myRightArrow = myButton.states.item(0).polygons.add({fillColor:myDocument.colors.item("Red")}); myRightArrow.paths.item(0).entirePath = [[72, 72],[144,108],[72, 144]]; //Add the Rollover state. var myRolloverState = myButton.states.add(); //Add a shadow to the polygon in the Rollover state. var myRolloverArrow = myRolloverState.polygons.add({fillColor:myDocument.colors.item("Red")}); myRolloverArrow.paths.item(0).entirePath = [[72, 72],[144,108],[72, 144]]; var myFillTransparencySettings = myRolloverArrow.fillTransparencySettings; myFillTransparencySettings.dropShadowSettings.mode = ShadowMode.drop; myFillTransparencySettings.dropShadowSettings.angle = 90; myFillTransparencySettings.dropShadowSettings.xOffset = 0; myFillTransparencySettings.dropShadowSettings.yOffset = 0; myFillTransparencySettings.dropShadowSettings.size = 6; //Add a shadow to the polygon in the Click state. var myClickState = myButton.states.add(); var myClickArrow = myClickState.polygons.add({fillColor:myDocument.colors.item("Blue")}); myClickArrow.paths.item(0).entirePath = [[72, 72],[144,108],[72, 144]]; //Set the behavior for the button. var myGoToNextPageBehavior = myButton.gotoNextPageBehaviors.add({behaviorEvent:BehaviorEvents.mouseUp}); Buttons can be used to control the playback of movie and sound files. The following script fragment shows an example of using a set of buttons to control the playback of a moving file (for the complete script, refer to MovieControl). //Given a page "myPage" in a document "myDocument," //containing the colors "Gray" and "Red"... var myFrame = myPage.rectangles.add({geometricBounds:[72, 72, 288, 288]}); //Import a movie file (you'll have to provide a valid file path on your system); myFrame.place(File("/c/movie.flv")); //Create the movie "Start" button. var myPlayButton = myPage.buttons.add({geometricBounds:[294,186,354,282], name:"PlayMovieButton"}); var myRightArrow = myPlayButton.states.item(0).polygons.add({fillColor:myDocument.colors.item("Gray")}); myRightArrow.paths.item(0).entirePath = [[186, 294],[186,354],[282, 324]]; //Add the Rollover state. var myRolloverState = myPlayButton.states.add(); //Add a shadow to the polygon in the Rollover state. var myRolloverArrow = myRolloverState.polygons.add({fillColor:myDocument.colors.item("Gray")}); myRolloverArrow.paths.item(0).entirePath = [[186, 294],[186,354],[282, 324]]; var myFillTransparencySettings = myRolloverArrow.fillTransparencySettings; myFillTransparencySettings.dropShadowSettings.mode = ShadowMode.drop; myFillTransparencySettings.dropShadowSettings.angle = 90; myFillTransparencySettings.dropShadowSettings.xOffset = 0; myFillTransparencySettings.dropShadowSettings.yOffset = 0; myFillTransparencySettings.dropShadowSettings.size = 6; //Add a shadow to the polygon in the Click state. var myClickState = myPlayButton.states.add(); var myClickArrow = myClickState.polygons.add({fillColor:myDocument.colors.item("Red")});