Friday, February 27, 2009

ARt 450 and Art 351 notes. Art 450 Final Crit.

Ashland Independent Film Festival Talk Friday, 11:00 Meese Auditorium!

ART 450 Final Critique will be Monday, March 16 at 6:30 p.m. in the digital lab.

Whitney Biennial 2008 site
Here's a nice image from the 2002 Biennial. It's Gilles Barbier's Nursing Home.

Wednesday, February 25, 2009

The Classic Artist's Programming Error


Here's a self-inflicted error you're likely to hit upon as the quarter comes crashing down upon your head. Hey, I just made this same mistake twice in the past hour. I am not Spock, clearly. Let it forever be known to us as, "The Equal Sign As Used In Programming Does NOT Equal The Equal Sign as Used in Math Error."

In other words:
= ≠ =

Ah ha ha ha ha ha!

We're used to saying things like "5 = 5," or "2 + 2 = 4." Ho hum. In a math context, "=" could be translated as "is." "5 is 5," or "2 + 2 is 4." In ActionScript, however, when we want to make plain old "is" statements we use the "==" operator, as in "5 == 5."

Here's the rub. In ActionScript, "=" is an active command, not a passive statement of fact. In programming, we can translate "=" as "gets" or "is now assigned the value of". For example, in ActionScript, the simple line of code written as

dx = 5;

is a command to the computer to, "under pain of death, drop whatever you were doing before and hold on to the value 5, you little maggot."

If you don't understand the difference between the two meanings, this will destroy you when you start working with if statements.

For example, here's a perfectly innocent looking function that is buggy as the day is long:

function checkLives (){
if (lives = 0) {
gameOver;
} // end if
}

In this trashy code, the computer will interpret "lives = 0" as a command to stop whatever the hell else it is doing and set the lives variable to 0. The effect is that the computer whilst innocently checking the "if"condition freaks out (pain of death, remember) and set the "lives" variable to 0. This makes the "if" condition true and so the gameOver function runs constantly. The game ends before it begins and you, the programmer are puzzled.

What you want to write instead is something like this:

function checkLives(){
if (lives == 0) {
gameOver;
} // end if
}

Our translation is now in line with what we actually want: "If lives equals 0, then run the gameOver function."

Thursday, February 12, 2009

Nifty Bit of Bloggery


Here's a cool Blogue from Graham Annable (that's his "Kodiak Mary" image above). He's a story artist, animator, and "comic fellow" who works for Laika up in Portland and recently worked on Coraline. Most importantly, he's a hockey teammate of SOU's own Jill Bruhn. Some very nice stuff; this guy's good. Check it out and get inspired.

Wednesday, February 11, 2009

Midterm Madness & Flash Demos

On Wednesday, Feb 18, we'll take a look at your midterm projects. . . so . . . get to work!
You can present one grand project or several smaller ones. It's up to you.

On Monday, Feb 23, you'll present pseudo code, concepts, and a work schedule for your final project.

Here are the .fla demo files we covered today:
sound01.fla
sound02.fla shows how to add a dynamic text box
sound03.fla shows how to place a movie clip on the stage with ActionScript
alarm.wav

Monday, February 9, 2009

Time For Tanklin


Click on the image at left to play Miles' first Flash game. It's retro and kind of difficult. Try to break 500.

Consider it an ode to the Atari 2600, the obscure Roosevelt Franklin from Sesame Street, his grandson "Franklin" from Arrested Development, and Vladimir Tatlin, Russian Constructivist. Actually, it's just a crappy third-rate beginner's video game, but I do like to prattle on. The base code comes from Andy Harris' outstanding Beginning Flash Game Programming for Dummies. This book is a fine intro for the coding impaired (like your truly).

Click here to download the tanklin.fla file for the game.

Heads You Lose Part 2




The evolution continues.

Art 351 Audio in Flash

General Sound Notes
0. Wear headphones.
1. Flash accepts .wav and .mp3 directly.
2. Pre-edit your sounds as much as possible in an audio program such as Garage Band or Audacity. Only import the parts you need. Flash is a clunky and inefficient place to edit audio.
3. Flash will recompress your audio file unless you tell it not to. The recompression can make the file sound lousy. Again, you'll have more control doing this in your editing program.
4. Keep all of your sound files together with your .fla files.

Here's how to bring sound into Flash
1. File > Import > Import To Library
2. Right click on the new sound symbol in the Library. Choose Properties.
3. Set your compression choice. Raw will stop Flash from compressing any further. This is usually what I'm after.
4. You'll see a dialogue box (pictured above). Hit the "Advanced" button at the bottom right of the dialogue box.
5. Check Export for ActionScript. Export in first frame will be checked too and an identifier name will also be added. Without this step, your ActionScript won't be able to refer to this file and nothing will work.
6. Many folk recommend 24 khz for music and even 11 khz for spoken words. Lower quality sound = lower bandwidth = faster load times. Mono is often just fine.

Here are the flame.wav and crash.wav files from Andy Harris' Beginning Flash Game Programming For Dummies. It's a great book.
Here's the basic sound.fla file taken from Harris' book.
Here's the Audrey.fla demo we did in class (where Miles accidentally wrote the code on the movie clip instead of the frame). Thanks to Melissa B. for letting us mangle her work!

Here's the code for the basic audio:
// ActionScript 2.0 Basic Sound handling based on Andy Harris' Beginning Flash Game Programming For Dummies. Adopted by Sir Milesicles

// Creates a movie that plays a sound. Yay.

// declare a new sound object named sndFlame using the new and Sound commands.
sndFlame = new Sound();

// fill the new sound object named sndFlame with an instance of the library symbol named "flame.wav"
sndFlame.attachSound("flame.wav");

// start the sndFlame sound object
sndFlame.start();

Tuesday, February 3, 2009

Heads, you lose






We'll critique your jump pieces in class on Wednesday. A quick note: 400 pixels wide seems to be about the maximum width for embeded .swf files in the blogspot blogs. Bigger widths wreck the layout. If you're working on a bigger piece you can either:
1. Not embed the swf, but post a still with a link to the .swf file.
2. Make a mini-version using the edit multiple frames onion skin option. (Save a copy BEFORE you do this--it can go hilariously wrong.)

Here's a link to the headsy.fla file above. And here's the code:

// headsy.fla ActionScript 2.0 by Miles Inada
// demonstrates how one button can control several movie clip timelines.
// the head movie clips have stops on frame 1 of their timelines.
// the body movie clip is looped and has a still rest frame on frame 40.

but01.onRelease = function(){
head1Ani.gotoAndPlay(2);
head2Ani.gotoAndStop(1);
head3Ani.gotoAndStop(1);
bodyAni.gotoAndStop(40);
}

but02.onRelease = function(){
head1Ani.gotoAndStop(1);
head2Ani.gotoAndPlay(2);
head3Ani.gotoAndStop(1);
bodyAni.gotoAndStop(40);
}

but03.onRelease = function(){
head1Ani.gotoAndStop(1);
head2Ani.gotoAndStop(1);
head3Ani.gotoAndPlay(2);
bodyAni.gotoAndStop(40);
}
//this button is placed over the figure's head to reset all movie clips to 1
clearButton.onRelease = function(){
head1Ani.gotoAndStop(1);
head2Ani.gotoAndStop(1);
head3Ani.gotoAndStop(1);
bodyAni.gotoAndPlay(1);
}

Monday, February 2, 2009

Doors of Perception




Head on over to Inadaville to check out a moving advent calendar solution.
Click here for the .fla file for the little door above.
Click here for the full moving doors .fla file o'er at Inadaville.
If you download the full moving doors, make sure you download this Door.as file and put it in the same location as the .fla file--otherwise the .fla file will not work.

Here's the code:
//Actionscript 2.0 doortestAS205.fla by Miles Inada

// Declare a boolean variable named shut, whose value (true or false) will indicate whether the door is currently shut (true) or open (false).
var shut:Boolean = true;

// Define the function openShutDoor. This function will check to see if the shut condition is true or false and act accordingly.
function openShutDoor() {
//check to see if the door is open or shut
if (shut) {
//if it's shut, open it
theDoor.gotoAndPlay(2);
//tell the program the door is now open
shut = false;
}else {
// if it's open, shut it
theDoor.gotoAndPlay(1);
//tell the program the door is now shut
shut = true;
} //end else
} // end function openShutDoor

// When theButton is clicked, run the openShutDoor function we've defined above
theButton.onRelease = openShutDoor;

// theDoor is a movie clip with a stop command on frame 1