Week 5 - Distribution and more

Script Locations, Manipulating Text, Digital Video and Sound, Distribution, Optimization

New Places for Scripts

Benefits: It can get a bit awkward to have everything happen with the frame script. It may feel more intuitive to place scripts on various buttons that have specific functions. You are treating different elements in your movie more like objects by attaching scripts to them - so they become discrete functioning parts of the movie.

Downsides: It can get really confusing. You can lose track of where things are. It is not something that happens in other programming languages.

Movie script: It is like the global script. Good place for your handlers. Change a script to a Movie script through the property inspector. Putting an event handler here (on mouseUp) will trigger the handler anywhere in the movie where the user clicks the mouse.

Frame script: The good old frame script. An event handler here (on mouseUp) will be triggered anytime the user clicks the mouse in the frame.

Member script: Attaches a script to a cast member. Anytime the cast member is clicked on anywhere in the movie, an event handler (on mouseUp) is triggered. [In the frame script, you can check for this by using the mousemember.] Select the cast member, then press the script icon on the upper right hand part of the cast.

Sprite script: Anytime the specific sprite is clicked on no matter where it is in the movie, the event handler will be triggered. [In the frame script, you can check for this by using the rollover or the clickon.] Create a behavior script, then drag it over the sprite you want to attach it to.

Message passing hierarchy
Event handlers get called in order determined by the message passing hierarchy. First looks at sprite script, then member script, then frame script, then movie script. Once it finds a handler in one of these scripts, it stops looking unless you specifically use the command "pass".


Manipulating Text

Text is seen as chunk expressions in lingo, broken up into line, word, char...

So say you have a field called member "EdisonWisdom" that says:
"Good fortune is what happens when opportunity meets with preparation...
Opportunity is missed by most people because it is dressed in overalls
and looks like work.
The three things that are most essential to achievement are common sense,
hard work and stick-to-it-iv-ness.....
Just because something doesn't do what you planned it to do in the first place doesn't mean it's useless....
If I find 10,000 ways something won't work, I haven't failed. I am not discouraged, because every wrong attempt discarded is just one more step forward....
Surprises and reverses can serve as an incentive for great accomplishment."


Access a particular word
put member("EdisonWidson").word[7]
--opportunity


Change a word
member("EdisonWidson").line[5].word[5] = "persistence"

Access a character
put member("EdisonWidson").line[8].word[7].char[4]
--'


ASCII numbers
Every character has a corresponding ASCII number.

put numtochar(65)
--A


put chartonum("a")
--97

Digital Video and Sound

Regular Video
Director can deal with Quicktime & .AVI movies.

Bring it into your movie by selecting File... Import
It doesn't actually import your movie into Director. It references it. This helps keep Director movie at a manageable size. Keep your QT movies in the same folder as the Director movie. If you move it from where it was when you originally imported it, Director will not know where it is.

Use property inspector to show Quicktime movie with controls.
Direct to stage means that Director will play it at fastest possible speed but it will always place it at the front of the stage so you can't have other sprites over it.

To figure out where you are in a movie,
put sprite(i).currentTime
--108540


To see how long your movie is,
put sprite(i).duration
--500290


sprite(i).movierate = 0 pauses movies
sprite(i).movierate = 1 plays
sprite(i).movierate = -1 plays in reverse
sprite(i).movietime = 0 rewinds to beginning
sprite(i).duration shows movietime in ticks

Streaming
Director can deal with streaming Realvideo & Quicktime.
See Using Video > Using Real Media Content in Director

Sound
sound(1).queue(member("somesound"))
sound(1).play()

See more on Sound in Help. Lots you can do.

Distributing Your Movie

If you want to show your movies to other people, you will have a problem unless they have Director on their machines.

But there are 2 easy solutions:
1. Making a projector - this is a standalone application that can be viewed on anyone's computer (though you need to create the projector on the same kind of computer the person will be viewing it on, i.e. creat a projector for a mac on a mac).
2. Making a Shockwave movie viewable on the web - people will have to have shockwave plug-in in their browser.

Making a projector
Very simple.
File -> Create Projector.
Add your .dir movie and anything else (for now, it will probably just be your .dir movie). Since digital video does not get imported directly into video, you must distribute it with your movie.

Making a shockwave movie
Also very simple
File -> Publish.
File -> Publish settings... allows you to change your settings.
Then you'll need to upload the html and the .dcr (Shockwave file) to the web.
If you don't have an account on stage.itp.nyu.edu, you can get one.

Optimization - Keeping your filesize small

Important for any movies distributed over the web!

bitmaps vs. vectors
Vector shapes and bitmaps are the two main types of graphics used with Macromedia Director MX.

A vector shape is a description that includes the thickness of the line, the fill color, and the location of the individual vectors and handlers (curve definers).

A bitmap is a grid of colored pixels. Each pixel has a specific color that is stored in memory.

Vectors require less RAM and disk space than an equivalent bitmap image and they download faster from the Internet. Flash uses vector shapes - one of the reasons it's so popular on the web.

Creating vector shapes
Open the vector shape window. Either create quick shapes or use the pen tool to define points through which a line passes. The shape can be a line, a curve, or an open or closed irregular shape that can be filled with a color or gradient.

You can also use Lingo to dynamically create and control vector shapes. You can create a vector shape entirely with Lingo or modify an existing one as the movie plays.

member(3).vertexlist = [[#vertex: point(-67.0000, -5.0000)], [#vertex: point(66.0000, -64.0000)], [#vertex: point(66.0000, 64.0000)], [#vertex: point(-67.0000, 64.0000)]]

member(3).vertexlist[2] = point(96.0000, -94.0000)
member(3).moveVertex(4, -30, 30)

2 ways to do the same thing...

Bitmaps
If you must use bitmaps, try to use the smallest bit depth possible.
1 bit (black or white) You can actually do a lot w/black and white
8 bit (256 colors) Illustrations
24 bit (thousands of colors) Photographs

Streaming Video
Useful because the movie starts playing before it is fully downloaded.