introduction to macromedia director 8.5 – lingo. scripting basics behaviors – scripts attached...

22
Introduction to Introduction to Macromedia Macromedia Director 8.5 – Lingo Director 8.5 – Lingo

Upload: kaitlyn-mcmanus

Post on 28-Mar-2015

237 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Introduction to Macromedia Director 8.5 – Lingo. Scripting basics Behaviors – Scripts attached to sprites or frames in the Score, referred to as a sprite

Introduction to Introduction to Macromedia Macromedia

Director 8.5 – Lingo Director 8.5 – Lingo

Page 2: Introduction to Macromedia Director 8.5 – Lingo. Scripting basics Behaviors – Scripts attached to sprites or frames in the Score, referred to as a sprite

Scripting basicsScripting basics

Behaviors – Behaviors – Scripts attached to sprites or frames in the Scripts attached to sprites or frames in the

Score, referred to as a sprite behavior or frame Score, referred to as a sprite behavior or frame behavior. This differs from the behaviors that are behavior. This differs from the behaviors that are in the library palette.in the library palette.

All behaviors that have been added to the cast All behaviors that have been added to the cast appear in the Behaviors inspector Pop up menu. appear in the Behaviors inspector Pop up menu. You can attach the same behavior to more than You can attach the same behavior to more than one location in the score. When you edit a one location in the score. When you edit a behavior, the edited version is applied behavior, the edited version is applied everywhere the behavior is attached in the everywhere the behavior is attached in the score.score.

Page 3: Introduction to Macromedia Director 8.5 – Lingo. Scripting basics Behaviors – Scripts attached to sprites or frames in the Score, referred to as a sprite

Scripting basicsScripting basics

Movie Scripts – Movie Scripts – These respond to events such as key presses, These respond to events such as key presses, mouse clicks and your own custom events, and mouse clicks and your own custom events, and can control what happens when a movie, starts, can control what happens when a movie, starts, stops or pauses. Handlers in a movie can be stops or pauses. Handlers in a movie can be called from other scripts on the movie as the called from other scripts on the movie as the movie plays.movie plays.Movie scripts are available to the entire movie, Movie scripts are available to the entire movie, regardless of which frame the movie is in or regardless of which frame the movie is in or which sprites the user is interacting with. When a which sprites the user is interacting with. When a movie plays a window or as a linked movie, a movie plays a window or as a linked movie, a movie script is available only to it’s own movie.movie script is available only to it’s own movie.

Page 4: Introduction to Macromedia Director 8.5 – Lingo. Scripting basics Behaviors – Scripts attached to sprites or frames in the Score, referred to as a sprite

Scripting basicsScripting basics

Parent scripts Parent scripts

These contain Lingo used to create child These contain Lingo used to create child objects. You can use parent scripts to objects. You can use parent scripts to generate script objects that behave and generate script objects that behave and respond similarly yet can still operate respond similarly yet can still operate independently of each other.independently of each other.

Scripts attached to cast membersScripts attached to cast members

Page 5: Introduction to Macromedia Director 8.5 – Lingo. Scripting basics Behaviors – Scripts attached to sprites or frames in the Score, referred to as a sprite

Script basicsScript basics

Scripts attached to cast membersScripts attached to cast members

These are attached directly to a cast These are attached directly to a cast member, independent of the Score. member, independent of the Score. Whenever the cast member is assigned to Whenever the cast member is assigned to a sprite, the cast members script is a sprite, the cast members script is available.available.

Page 6: Introduction to Macromedia Director 8.5 – Lingo. Scripting basics Behaviors – Scripts attached to sprites or frames in the Score, referred to as a sprite

How scripts flowHow scripts flow

Director always executes Lingo Director always executes Lingo statements starting with the first statement statements starting with the first statement and continuing in order until it reaches the and continuing in order until it reaches the final statement or a statement that final statement or a statement that instructs Lingo to go somewhere elseinstructs Lingo to go somewhere else

To set up statements so that they run To set up statements so that they run when specific conditions exist, you use if…when specific conditions exist, you use if…then, case, and repeat loop structures.then, case, and repeat loop structures.

Page 7: Introduction to Macromedia Director 8.5 – Lingo. Scripting basics Behaviors – Scripts attached to sprites or frames in the Score, referred to as a sprite

The order in which statements are The order in which statements are executed affects the order in which you executed affects the order in which you should place statements. should place statements. If you write a statement that requires some If you write a statement that requires some calculated value, you need to put the calculated value, you need to put the statements that calculates the value first.statements that calculates the value first.

X = 2+2X = 2+2Put string (x) into member “The Answer”Put string (x) into member “The Answer”

Page 8: Introduction to Macromedia Director 8.5 – Lingo. Scripting basics Behaviors – Scripts attached to sprites or frames in the Score, referred to as a sprite

Planning is essentialPlanning is essential

Before writing reams of scripts, formulate Before writing reams of scripts, formulate your goals and understand what you want your goals and understand what you want to achieve.to achieve.

Scripting and testing will take time so be Scripting and testing will take time so be patient!patient!

The best approach is start simple and test The best approach is start simple and test frequently.frequently.

Page 9: Introduction to Macromedia Director 8.5 – Lingo. Scripting basics Behaviors – Scripts attached to sprites or frames in the Score, referred to as a sprite

Attaching script - Attaching script -

Double click the behavior channel in the frame that you want to attach a behavior to.

Behavior channel

Most common frame behaviors – keeps playback head looping a single frame. This is useful when you want your movie to keep playing in a single frame while waiting for the user to click a button or for a digital video or sound to finish playing.

Page 10: Introduction to Macromedia Director 8.5 – Lingo. Scripting basics Behaviors – Scripts attached to sprites or frames in the Score, referred to as a sprite

The lingo expression….The lingo expression….

““the frame” always refers to the frame the frame” always refers to the frame currently occupied by the playhead. This currently occupied by the playhead. This statements essentially tells the playback statements essentially tells the playback head to “go back to the frame you are head to “go back to the frame you are currently in”.currently in”.

Page 11: Introduction to Macromedia Director 8.5 – Lingo. Scripting basics Behaviors – Scripts attached to sprites or frames in the Score, referred to as a sprite

To create a sprite behavior (script To create a sprite behavior (script attached to a sprite)attached to a sprite)

In the score or on the stage, select the In the score or on the stage, select the sprite that you’re attaching the behavior to. sprite that you’re attaching the behavior to. Then select Window, Behavior Inspector Then select Window, Behavior Inspector and select New Behavior from the pop up and select New Behavior from the pop up menu.menu.

Inputs – on mouse up and end – making it Inputs – on mouse up and end – making it easy to attach a common behavior.easy to attach a common behavior.

Page 12: Introduction to Macromedia Director 8.5 – Lingo. Scripting basics Behaviors – Scripts attached to sprites or frames in the Score, referred to as a sprite

To open a behavior for editing:To open a behavior for editing:

Double click the behavior in the cast Double click the behavior in the cast WindowWindow

Click the Script Window icon in the Click the Script Window icon in the Behavior inspector.Behavior inspector.

Page 13: Introduction to Macromedia Director 8.5 – Lingo. Scripting basics Behaviors – Scripts attached to sprites or frames in the Score, referred to as a sprite

To remove a behavior from a score To remove a behavior from a score location:location:

Select the location and then delete the Select the location and then delete the script from the list displayed in the script from the list displayed in the Property InspectorProperty Inspector

Page 14: Introduction to Macromedia Director 8.5 – Lingo. Scripting basics Behaviors – Scripts attached to sprites or frames in the Score, referred to as a sprite

To attach existing behaviors to sprites or frames:To attach existing behaviors to sprites or frames:

Drag a behavior from a cast to a sprite or frame Drag a behavior from a cast to a sprite or frame in the score or (for sprites) to a sprite on the in the score or (for sprites) to a sprite on the stage.stage.

In the score select the sprites or frames that In the score select the sprites or frames that you’re attaching the behavior to. Then select you’re attaching the behavior to. Then select Window, Behavior Inspector and select the Window, Behavior Inspector and select the existing behavior from the pop up menu.existing behavior from the pop up menu.

Page 15: Introduction to Macromedia Director 8.5 – Lingo. Scripting basics Behaviors – Scripts attached to sprites or frames in the Score, referred to as a sprite

To create a movie script: (script attached To create a movie script: (script attached to a movie)to a movie)

If the current script in the script window is If the current script in the script window is a movie script, click the New Script button a movie script, click the New Script button in the Script windowin the Script window

Page 16: Introduction to Macromedia Director 8.5 – Lingo. Scripting basics Behaviors – Scripts attached to sprites or frames in the Score, referred to as a sprite

Lingo terminologyLingo terminology

Arguments – Arguments –

Placeholders that let you pass values to Placeholders that let you pass values to scripts e.g.scripts e.g.

On addThem a,bOn addThem a,b– c = a +bc = a +b

EndEnd

Page 17: Introduction to Macromedia Director 8.5 – Lingo. Scripting basics Behaviors – Scripts attached to sprites or frames in the Score, referred to as a sprite

Commands:Commands:

Instruct a movie to do something while the Instruct a movie to do something while the movie is playing e.g. go the framemovie is playing e.g. go the frame

Constants: Elements that don’t change. Constants: Elements that don’t change. TAB, EMPTY and RETURNTAB, EMPTY and RETURN

Events: Actions occur while a movie Events: Actions occur while a movie

Expressions: any past of a statement that Expressions: any past of a statement that produces a value e.g 2+2produces a value e.g 2+2

Page 18: Introduction to Macromedia Director 8.5 – Lingo. Scripting basics Behaviors – Scripts attached to sprites or frames in the Score, referred to as a sprite

Functions:Functions:

Return a value – dateReturn a value – date

Handlers:Handlers:

Lingo statements within a script that run Lingo statements within a script that run when a specific event occurs in a movie when a specific event occurs in a movie e.g. beepe.g. beep

Keywords – reserved words that have a Keywords – reserved words that have a special meaning e.g. endspecial meaning e.g. end

Page 19: Introduction to Macromedia Director 8.5 – Lingo. Scripting basics Behaviors – Scripts attached to sprites or frames in the Score, referred to as a sprite

Lists – ordered sets of values used to track and Lists – ordered sets of values used to track and update an array of data, such as a series of update an array of data, such as a series of names or the values assigned to a set of names or the values assigned to a set of variables. E.g. [1,4,2]variables. E.g. [1,4,2]

Messages – notices that Director sends to Messages – notices that Director sends to scripts when specific events occur in a moviescripts when specific events occur in a movie

Operators – calculate a new value from one or Operators – calculate a new value from one or more values. E.g. +, operator adds two or more more values. E.g. +, operator adds two or more values together to produce a new valuevalues together to produce a new value

Page 20: Introduction to Macromedia Director 8.5 – Lingo. Scripting basics Behaviors – Scripts attached to sprites or frames in the Score, referred to as a sprite

Properties are attributes that define an Properties are attributes that define an object. object.

Variables – elements to store and update Variables – elements to store and update values. To assign values to variables or values. To assign values to variables or change the values of many properties you change the values of many properties you use the = operator or the set commanding use the = operator or the set commanding set startValue == 0 places a value of 0 into set startValue == 0 places a value of 0 into a variable named startValuea variable named startValue

Page 21: Introduction to Macromedia Director 8.5 – Lingo. Scripting basics Behaviors – Scripts attached to sprites or frames in the Score, referred to as a sprite

Lingo supports a variety of data types, Lingo supports a variety of data types, including references to sprites and cast including references to sprites and cast members, TRUE and FALSE or 1 and 0 members, TRUE and FALSE or 1 and 0 (Boolean) values, strings, constants, (Boolean) values, strings, constants, integers, floating point numbers, points, integers, floating point numbers, points, reacts, colors and datesreacts, colors and dates

Page 22: Introduction to Macromedia Director 8.5 – Lingo. Scripting basics Behaviors – Scripts attached to sprites or frames in the Score, referred to as a sprite

Lingo is not case sensitive – you can use Lingo is not case sensitive – you can use uppercase letters however you wantuppercase letters however you want