Adobe 0046100128056 Scripting Guide - Page 156
Creating Multistate Objects
UPC - 718659087562
View all Adobe 0046100128056 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 156 highlights
CHAPTER 11: Creating Dynamic Documents Creating Multistate Objects 156 myClickArrow.paths.item(0).entirePath = [[186, 294],[186,354],[282, 324]]; //Set the behavior for the button. var myMovieStartBehavior = myPlayButton.movieBehaviors.add({movieItem:myFrame.movies.item(0), behaviorEvent:BehaviorEvents.mouseUp, operation:MoviePlayOperations.play}); //Create the movie "Stop" button. var myStopButton = myPage.buttons.add({geometricBounds:[294,78,354,174], name:"StopMovieButton"}); var myNormalRectangle = myStopButton.states.item(0).rectangles.add({geometricBounds:[294,78,354,174], fillColor:myDocument.colors.item("Gray")}); myRolloverState = myStopButton.states.add(); var myRolloverRectangle = myRolloverState.rectangles.add({geometricBounds:[294,78,354,174], fillColor:myDocument.colors.item("Gray")}); var myFillTransparencySettings = myRolloverRectangle.fillTransparencySettings; myFillTransparencySettings.dropShadowSettings.mode = ShadowMode.drop; myFillTransparencySettings.dropShadowSettings.angle = 90; myFillTransparencySettings.dropShadowSettings.xOffset = 0; myFillTransparencySettings.dropShadowSettings.yOffset = 0; myFillTransparencySettings.dropShadowSettings.size = 6; myClickState = myStopButton.states.add(); var myClickRectangle = myClickState.rectangles.add({geometricBounds:[294,78,354,174], fillColor:myDocument.colors.item("Red")}); var myMovieStopBehavior = myStopButton.movieBehaviors.add({movieItem:myFrame.movies.item(0), behaviorEvent:BehaviorEvents.mouseUp, operation:MoviePlayOperations.stop}); Buttons are also important in controlling the appearance of multistate objects, as we'll demonstrate in the next section. Creating Multistate Objects Multistate objects (or MSOs) are similar to buttons in that they contains states, and that only one state can be visible at a time. They are unlike buttons in that they can contain any number of states; buttons can contain three states, at most. Multistate objects rely on buttons to change the way they display their states. The following script fragment shows how to create a simple multistate object and add a button to control the display of the states in the object (for the complete script, refer to MakeMultiStateObject).