Download presentation
Presentation is loading. Please wait.
Published byClare Strickland Modified over 9 years ago
1
Scripts Director’s scripting language is called Lingo Lingo can be used to offer your users navigational control of the order of the scenes of your movie. Instructions to tell Director how your movie should respond when specific events occur during play. Director provides a dictionary of Lingo elements
2
Lingo I A Director’s programming language that includes, like other languages, variables, functions, lists. Other Lingo terminology: Commands are terms that instruct a movie to do something while the movie is playing. For example, go to sends the play head to a specific frame, a marker, or another movie. Events are actions that occur while a movie is playing. For example, when a movie stops, a sprite starts, the play head enters a frame, or the user types at the keyboard, these actions are events.
3
Lingo II Handlers are sets of Lingo statements within a script that run when a specific event occurs in a movie. For example, the following statements comprise a handler that plays a beep sound when the mouse button is clicked: on mouseDown beep end Messages are notices that Director sends to scripts when specific events occur in a movie. For example, when the play head enters a specific frame, the enterFrame event occurs and Directors sends an enterFrame message. If a script contains an on enterFrame handler, the statements within that handler will run, because the handler received the enterFrame message.
4
Events Key events keyUp keyDown Frame events prepareFrame exitFra me Sprite event beginSprite endSprite Mouse events mouseUp mouseDown mouseEnter mouseWithin mouseLeave rightMouseUp rightMouseDown User defined events
5
Script Types Behaviors Scripts User defined behaviors Library palette Movie Scripts Parent Scripts Scripts attached to cast members Script Statements
6
Behavior script You can use the Behavior Inspector to add interactive features to movies without having to write or understand Lingo. You can attach multiple Behavior Scripts to one sprite, but you can attach only one script per frame in the script channel. When a sprite has multiple Behaviors that respond to the same event, each of them is executed in the order in which you attached them. In the cast the icon appears to indicate that it is a behavior
7
Behavior script Activation The events that can activate a Behavior Script attached to a sprite when the pointer is positioned on the sprite, or when the sprite begins or ends in the score When attached to a frame, the instructions in a behavior script are available to be executed only when the playback head is in a frame containing the script and when the specified event for which the script is waiting occurs
8
User defined behaviors I property spriteNum -- comes after next slide on mouseWithin(me) sprite(SpriteNum).Color = color(77) MoveMe(30) end mouseWithin on moveMe x sprite(spriteNum). locH = sprite(spriteNum). locH + x end
9
User defined behaviors II Frame Behavior on exitFrame me go to frame 1 -- go to the frame is a loop end Sprite Frame on beginSprite me set the loc of sprite the currentSpriteNum to point (50,50) end
10
Property I Lingo syntax: property property1 {, property2} {,property3} {...} Keyword; declares the properties specified by property1, property2, and so on as property variables. Declare property variables at the beginning of the script. You can access them from outside the script by using the the operator.
11
Property II For behaviors, properties defined in one behavior script are available to other behaviors attached to the same sprite. Example of properties to sprite property spriteNum, memberNum, temp
12
Library Behaviors The Library Palette is basically a list of pre-set behaviors that can be selected for a movie After a built-in behavior has been assigned to either a sprite or a frame it will be placed automatically into the Cast window It can easily be modified and can be assigned to any sprite or frame directly from the cast window
13
Appling a Built-in Behavior Select the sprite Open library Palette Select the behavior you want to use Hold the mouse and drag it on top of the sprite in the Stage that you want to add it to A window will open up for you to add or change parameters to meet your own specifications
14
Categories of Built-in Behaviors 3D Accessibility Animation Controls Internet Media Navigation PaintBox Text
15
3D Built-in Behaviors Director includes a library of behaviors that lets you build and control a 3D environment. There two types Actions Triggers Examples Fly Through: Simulates flying through the 3D world with a camera. Orbit Camera: Circles the camera around a model.
16
Accessibility Built-in Behaviors Director includes features that let you make existing and new movies accessible to users who have hearing, visual, or mobility impairment. Examples: You can make sprites on the Stage navigable with the keyboard You can add the ability for your text cast members to be spoken aloud by the computer Most accessibility behaviors cannot be used alone and must be used with other accessibility behaviors
17
Animation Built-in Behaviors They are 3 types: Automatic: changes some of the properties an automatic way Interactive: changes some of the properties using the mouse Transitions: create brief animations that play between frames to create a smooth flow as sprites move, appear, or disappear or as the entire Stage changes Following are examples.
18
Example: Color Cycling An Automatic Animation behavior Allows you to cycle a sprite’s color through various ranges of either RGB or other palettes. The cycle rate can be set as the cycle can also move continuously or through a set number of cycles
19
Example: Random Movement An Automatic behavior Allows you to animate a sprite along a random path while setting its motion and speed
20
Example: Avoid mouse An Interactive Animation Behavior Makes the sprite to move a way in a specified speed from the curser
21
Example: Slide spriet A Transition Animation Behavior Makes the sprite to slide in a specified speed from the curser
22
Movie Script I Movie Scripts initiate events for controlling what will take place when a movie begins. The icon that will appear at the lower right corner of the movie script Cast Member. Movie scripts are available to the entire movie and are not explicitly attached to any object.
23
Movie Script II Movie scripts are a good place to handle events relating to the movie’s starting and stopping. startMovie and stopMovie handlers Define global properties Example: Change movie tempo on startMovie _movie.puppetTempo(10) end if
24
Parent Scripts Parent Scripts contain Lingo needed to create child objects Parent scripts create script objects that behave and respond in a similar fashion, and they can also work independently The main function of using the parent scripts to create a child object is to make organizing movie logic much simpler When a movie may need to be run a multiple of times with various parameters.
25
Parent Script Example Create a new instance of the object. on new(me) return(me) end Create the child object newFlowerChildObject = new(script “name") Where name is the cast member name containing the parent script. Behaviors in the parent script can be accessed and using ● notation. For example: newFlowerChildObject ● behaviorname
26
Scripts attached to cast members I A Cast-Member Script is attached to one cast member, the icon above appears in the cast member in the bottom right corner Can’t be shared and reassigned the way a Behavior Script can A cast-member script is the only script type that is not itself a cast member The types of events that can activate a cast-member script are limited to mouse or keyboard event
27
Scripts attached to cast members II One advantage of a cast-member script is that its Lingo instructions can run when any sprite based on the cast member is activated If a sprite has both a Cast-Member script and a Behavior script associated with it, the behavior script takes precedence in trapping events.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.