Tuesday, November 25, 2008

Total Sums and Output code

on(release) {
_root.calculator.outputBox = "";

TotalSum = 0;

for (var i:Number = 0; i< MySums.length; i++) {

_root.calculator.outputBox += MySums[i] + newline;
TotalSum += MySums[i];
trace(TotalSum);
}
_root.calculator.outputBox += "---" + newline;
_root.calculator.outputBox += TotalSum;

}

= button

on(release) {
// = button
NumberTwo = _root.calculator.outputBox

// You will need to add numbers
/// You can use the parseInt()
var Sum:Number = parseInt(NumberTwo) + parseInt(FirstNumber);
_root.calculator.outputBox = FirstNumber + newline + "+"
+ NumberTwo + "=" + Sum ;
}

+ button

on(release) {
// + button
FirstNumber = outputBox;
_root.calculator.outputBox = FirstNumber + newline + "+";
}

_root.calculator.outputBox = what.charAt(1)

// movie clip is the button for each number

on(press) {
// b2

// name each instance... b0...b1...b2...b3
var what:String = this._name;

// what.charAt(1); strips the instance name of the "b"
// gets the character at index 1
// TIP: remember indexing begins with 0,
// so index position 1 is really character 2
// then it puts the result in to the output window
_root.calculator.outputBox = what.charAt(1);

}

Project#4: Interactivity

LEARNING OBJECTIVES:
Upon successful completion of this project the student will be able to do the following:
• Integrate the User (through User input) into the presentation
• Design Actionscripts creating interactive functionality
• Understand complex objects and integrated systems
• Recognize design principles across multi-media forms
• Demonstrate how type, sound, graphics, and interactivity can be integrated into telling a unified story

PROCESS & CRITERIA:
Represent the kinetic story with text, sound, images and interactivity.
i) Submit a FINAL kinetic story built in FLASH, integrating text, sound, graphical images and interactivity. Include on the CD, the .fla, .swf, PC & MAC Projector.
ii) Submit a written (one page) report explaining your comments about the whole process of creating a digital multi-media presentation using text, sound, images and interactivity. This report should include a self-evaluation of how you valued the process and your project outcomes.

Due Dates:
1) Sketches & Model: Due Week #13
2) Working Revised Model: Due Week #14
3) THE FINAL INTEGRATED STORY: Due Week #15

IMPORTANT NOTE:
Include all Process stages (1,2,3) when submitting PROJECT #4,Week #15.

Monday, November 24, 2008

Basic Computer Concepts & SCRIPT EXAMPLES

Basic Computer Concepts (Storage, Selection, Repetition)
1) Store items in a variable.
2) An Array is a related list of items.
3) A conditional (if/else) statement functions like an on/off switch
4) A "for" loop is a counter loop

EXAMPLE 01:
• index variable
• Pushing data into an Array;
• text field/variable output
• Trace output

// The script is on an instance of a movie clip
on (press) {
// variable num is rooted at Stage
// add item to the Array
var num:Number = _root.myData.push(this._name)-1;

// OUTPUT to STAGE: text field on the screen
_root.whatclicked = "num: " + num + newline +
"_root.myData[num]: " + _root.myData[num] + newline +
"_root.myData: " +_root.myData;

// TRACE window output
trace("num: " + num);
trace("_root.myData[num]: " + _root.myData[num]);
trace("_root.myData: " +_root.myData);
trace(_root.myData.length);
}
---------------------------------------------------------

EXAMPLE 02:
• Repeat loop
• index variable "i"
• condition using length
• increment i++
• Array item

on(release) {
// clear the text field
_root.whatclicked = "";
// output to the text field the items in the Array
// each item is placed on a new line
for (var i:Number = 0; i<_root.myData.length; i++) {
_root.whatclicked += _root.myData[i] + newline;
}
}
---------------------------------------------------------

EXAMPLE 03:
• startDrag()
• x and y locations
• stopDrag()
• setting a variable + 1
• duplicate this movie clip
• assign a location x and y

on(press) {
this.startDrag();
whereX = this._x;
whereY = this._y;

}
on(release) {
this.stopDrag();

_root.iteration++
trace(i);
// this is what is duplicated, new name, depth
this.duplicateMovieClip("clip=" + _root.iteration, _root.iteration);
this._x = whereX;
this._y = whereY;

}
---------------------------------------------------------

EXAMPLE 04:
• Drag and drop album covers to play mp3 file
• Selection structure (if else)
• FRAME SCRIPT example for movie clip instances

// all in FRAME SCRIPT
var dancing:Sound = new Sound();
// ALBUM #1 ****************************************************//
album1_mc.onPress = function():Void {
this.startDrag(true);
reply_txt.text = "";
reply_txt.text = "Selected Album#1";


// snapback code begins ************************ //
if (album1_mc._x == squareTarget_mc._x) {
snapback = true;

}else {
// start position
startpositionX = album1_mc._x;
startpositionY = album1_mc._y;
}
// snapback code ends ************************ //



album1_mc.swapDepths(this.getNextHighestDepth());
// xstart = this._x;
// start = this._y;
dancing.stop();
};

//ALBUM #1
album1_mc.onRelease = function():Void {
this.stopDrag();

// snapback code begins ************************ //
if(snapback) {
album1_mc._x = startpositionX;
album1_mc._y = startpositionY;
snapback = false;

}else {
// snapback code ends ************************ //


if (eval(this._droptarget) == squareTarget_mc) {
reply_txt.text = "Playing Album#1";
// this.enabled = false;
// snap album cover to the movie clip target //
album1_mc._x = squareTarget_mc._x;
album1_mc._y = squareTarget_mc._y;
// ----------------------------------------- //
counter++;
dancing.loadSound("1.mp3", true); // true is for streaming mp3 file
dancing.start(0,1);
onoff = true;

} else {
reply_txt.text = "Try Again";
this._x = xstart;
this._y = ystart;
}
} // include this closure of the snapback else
};

// end of ALBUM #1 **********************************************//

Saturday, November 22, 2008

Contest: Describe your most rewarding learning experience

NISOD Student Essay Contest

The National Institute for Staff and Organizational Development (NISOD) has announced a student essay contest to mark Community College Week.

The winning essay is awarded a total of $3,000US to be shared with the student author, the faculty/staff/administrator featured in the essay and the college.

The essay topic is: Describe your most rewarding learning experience with a faculty, staff or administrator at your community college.

Entries from GBC students will be eligible for 3 prizes of $300, $200 and $100 from GBC's Vice-President Academic's office. Deadline for GBC is December 1, 2008 please send GBC entries to Michael Cooke at mcooke@georgebrown.ca.

More details available at www.nisod.org/student_essay.html

Wednesday, November 12, 2008

Three arrays and assign them items.

var myPics:Array = Array("myPicsfirst", "myPicssecond", "myPicsthird");

var myAudio:Array = Array("myAudiofirst", "myAudiosecond", "myAudiothird");

var myType:Array = Array("myTypefirst", "myTypesecond", "myTypethird");

this._name & myShow.push(this._name)

ACTIONSCIPT:
this._name
// the _name property: gets the name of this, whatever this is.

myShow.push(this._name)
// pushes what's inside the brackets into the array myShow

// FOR EXAMPLE:
// MOVIE CLIP INSTANCE SCRIPT
on (press) {
_root.remote.what = this._name;
/* gets the name of this Movie Clip instance
that is on the Stage, and places the name
in the variable/text field: _root.remote.what

_root.remote.myShow.push(this._name);
/* Pushes the name of this into an array named myShow
located within the Movie Clip _root.remote
}

Friday, November 7, 2008

Tuesday, November 4, 2008

hittest scripts

In this example, drag the girl over the seashell.

// girl instance script
onClipEvent(mouseDown){
startDrag(this);
}
onClipEvent(mouseUp){
stopDrag();
}


// FRAME 1 script
// girl movie clip instance
girl.onPress = function() {
this.startDrag();
};

// girl movie clip instance
girl.onRelease = function() {
this.stopDrag();
// seashell_01 instance
if (this.hitTest(seashell1)) {
_global.totalpickedup = 1;
_root.seashell1._visible = 0;
trace("you picked up a SeaShell");
}
// seashell_02 instance
if (this.hitTest(seashell2)) {
_global.totalpickedup = 1;
_root.seashell2._visible = 0;
trace("you picked up a SeaShell");
}
};

Saturday, November 1, 2008

Week 10: Automation & Scripting

In Photoshop you can automate a batch processing of a series of files.
For example, Photoshop can automate the renumbering of photos. After they are renumbered, you would be able to write some Javascript or some Actionscript to place the pictures on the screen based upon their numerical sequence ( 1,2,3,4,5....).

The following video shows how to automate the renumbering process with a 1-Digital-Serial renumbering:




After renumbering the jpgs, they can be resized using an image processing script, as follows: