Class Notes
General Q and A
Align Navigation Demo
Functions, Functions, Functions
Reading:
(the end of this post is pretty advanced.... and not super important... the important part is the version of what we did today...)
http://www.learningactionscript3.com/2008/05/13/the-power-of-relative-positioning/
Homework:
Be sure to look over the function_practice.fla and nerd_functions.fla. If you have
any questions about writing functions e-mail me. If you can't figure out how
to write one of the below functions, feel free to email me. You should also attempt to
write some functions that aren't on this list. Be creative and try to challenge yourself...
write functions related to subjects that interest you.
// converts meters to centimeters:
// takes one argument in meters
// returns the number in centimeters
mToCM(meters);
for the below two functions you can find the math you need here:
http://en.wikipedia.org/wiki/Kelvin
// converts fahrenheit to kelvin - (temperature);
// takes one argument, the degrees in fahrenheit
// returns degrees in kelvin
tempFtoK(32);
// converts kelvin to fahrenheit- (temperature);
// takes one argument, the degrees in kelvin
// returns degrees in fahrenheit
tempKtoF(32);
// use google to find the equations for these:
// millileters to fluid ounces, and fluid onces to millileters
// calculates the area of a rectangle:
// takes 2 arguments, width and height of the rectangle
// returns the area of the rectangle
area(10, 20);
// adds 3 numbers together
// takes 3 arguments and adds them together
// returns the result of the addition of the three arguments
add3(100, 20, 300);
Conversion/Math BONUS:
// calculates the volume of a cube
// takes 1 argument, the length of any side of the cube
// returns the area of the cube
area(100);
Take a look at how we wrote the setupBtn() function in the file: align_demo_zenos_functions.fla
Try to use this technique somewhere in one of your existing homework files or personal/work projects.
ClassFiles
Subscribe to:
Post Comments (Atom)
Hi Zevan,
ReplyDeleteI emailed you the music player code that you were helping me with after class. Please let me know if you need the FLA file as well. Thanks again!!
Best,
Dave Schwartz
I don't even know if we're supposed to do this or not, but this comment is to confirm that Samantha Merley was in class on Sunday 11/8.
ReplyDelete